BigQuery加载数据集时报JSON第25位意外标记g错误的咨询
错误原因
- 第一个字段
glide_no的description属性值不符合JSON语法:你当前写的是"description": glide_no"",字符串值没有用双引号开头,还多写了冗余的闭合双引号,JSON解析器读取到位置25的字符g时无法识别为合法JSON值,直接触发报错。 - 标准JSON规范不支持
/* */格式的注释,你在haulier字段定义行添加的注释属于非法内容,同时注释的闭合符号写错(你写的是/*,正确注释闭合为*/),也会导致JSON解析失败。
解决方案
修正表结构定义的JSON代码,去掉非法注释,补全正确的字符串包裹符号,修正后的完整代码如下:
[ { "description": "glide_no", "mode": "NULLABLE", "name": "glide_no", "type": "INTEGER" }, { "description": "vehicle registration number", "mode": "NULLABLE", "name": "vehicle", "type": "STRING" }, { "description": "PSP CODE", "mode": "REQUIRED", "name": "client", "type": "STRING" }, { "description": "Company name", "mode": "REQUIRED", "name": "haulier", "type": "STRING" }, { "description": "waste type", "mode": "NULLABLE", "name": "waste_type", "type": "STRING" }, { "description": "source of waste", "mode": "NULLABLE", "name": "source", "type": "STRING" }, { "description": "gross weight in kg", "mode": "REQUIRED", "name": "gross_weight", "type": "INTEGER" }, { "description": "tare weight in kg", "mode": "REQUIRED", "name": "tare_weight", "type": "INTEGER" }, { "description": "net weight in kg", "mode": "REQUIRED", "name": "net_weight", "type": "INTEGER" }, { "description": "gross date", "mode": "REQUIRED", "name": "gross_date", "type": "DATETIME" }, { "description": "tare date", "mode": "REQUIRED", "name": "tare_date", "type": "DATETIME" }, { "description": "day of the week", "mode": "REQUIRED", "name": "day", "type": "STRING" }, { "description": "month of the year", "mode": "REQUIRED", "name": "month", "type": "STRING" }, { "description": "vehicle condition rating", "mode": "NULLABLE", "name": "memo", "type": "STRING" }, { "description": "vehicle type", "mode": "REQUIRED", "name": "vehicle_type", "type": "STRING" } ]
修正后可先通过JSON校验工具验证语法合法性,再导入BigQuery即可正常加载。
内容的提问来源于stack exchange,提问作者Ifeoluwa Clement
相关产品推荐
相关产品推荐

