我有 json
验证时出错" Key1":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14,17,32,57,57 ,60,57,60,64,87,92,92,92,92,92,172,168,168,168,168,168,168,168,168,163,163,186,186,199,199,199,224,230,255,270,287,338,338,338,338,381,382,394,393,434,434,436,445,427,431,434,421,420,432,448,465,498,580,584,667,691,685,732,783,817,842,879,1001,1098,1143,1221,1265,1339,1401,1419,1519,1513,1581,1629,1604,1613,1571 ,1592,1532,1561,1656,1610,1561,1579,1383,1181,1120,1140,950,932,972,974,1060,1077,1113,1147,1200,1144,1191,1225,1260,1276,1333,1334,1273 ,1241,1287,1263,1338,1301,1303,1373,1292,1327,1338,1374,1369,1338,1334,1289,1230,1332,1309,1298,1258,1302,1328,1297,1233,1265 ,1247,1265,1300,1278,1271,1291,1320,1324,1367,1349,1382,1376,1389,1379,1433,1429,1462,1525,1405,1429,1406,1360,1383,1438,1383 ,1414,1385,1372,1387,1389,1349,1401,1400,1272]," Key2" :[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4.38,2.55,-0.63,-1.01,-1.62,-4.45,2.68,2.86,3.34,-0.41,1.5 ,2.58,-0.36,-0.56,-4.39,-3.7,0.65,-4.71,4.69,6.59,-1.95,0.67,-0.37,-0.78,4.49,4.56,1.25,1.13,1.54,1.3,3.64,1.07 ,2.94,1.45,1.65,-0.49,-2.09,0.88,1.44,-2.83,-0.41,2.95,1.09,3.79,1.81,-0.65,2.27,-1.42,-1.58,2.49,2.71,3.25,1.87, 2.38,-2.05,1.9,2.53,4.99,-0.53,2.16,1.94,-1.12,-0.5,-0.21,1.84,0,2.32,2.02,1.04,1.65,0.96,1.01,2.82,2.82,0.17,0.3 ,-0.88,3.17,2.87,-2.12,0.71,-3.96,1.62,-2.89,5.17,2.68,-2.48,-2.4,-0.42,-12.74,-13.34,-5.11,1.98,1.61,-1.92, 4.15,6.32,8.35,1.21,5.15,2.47,4.5,-2.59,3.26,2.68,-1.53,1.06,3.8 1,0.19,-4.62,-2.45,3.61,-1.77,5.03,3.18,-0.18,4.57,0.38,1.78,0.65,1.65,-0.89]
Parse error on line 1:
"Key1" : [null,
^
Expecting '{', '['
任何人都可以帮我识别问题吗?
答案 0 :(得分:4)
有效JSON是对象或数组。因此,JSON应始终以{
或[
开头。在你的情况下,你没有。你只有一个名为'Key1'的属性,它不属于任何东西。
试试这个:
{"Key1": [null,null,null,"etcetera"]}
结果是一个对象有一个属性Key1,它是一个包含所有值的数组。
作为T.J. Crowder指出,rfc7158表明有效文档不必是对象或数组,但可以是任何受支持的JSON类型值(字符串,布尔值等)。但是,http://JSONLint.com尚不支持此功能。无论如何,您的文档仍然无效,因为它不是由单个值组成,而是由属性声明组成(冒号分隔属性名称及其值)。这样的声明必须始终是对象的一部分。
有关JSON表示法的更多详细信息,请参阅http://www.json.org/。