[Gambas-user] JSON.Decode error in gb.util.web??

Martin mbelmonte at belmotek.net
Mon Nov 9 18:56:43 CET 2020


Well, is correct that the row 11300 column 7 was wrong but there is not 
the first problem that appear in JSON.Reader. Also there are an other 
problem related to Key empty.

here we are one sample code:

   "items": {
     "ACAD_COLOR": [2, 1, 41, 41],
     "ACAD_GROUP": [2, 1, 37, 37],
     "ACAD_LAYOUT": [2, 1, 13, 13],
     "ACAD_MATERIAL": [2, 1, 40, 40],
     "ACAD_MLEADERSTYLE": [2, 2, 331, 331],
     "ACAD_MLINESTYLE": [2, 1, 38, 38],
     "ACAD_PLOTSETTINGS": [2, 1, 39, 39],
     "ACAD_PLOTSTYLENAME": [2, 1, 8, 8],
     "ACAD_SCALELIST": [2, 2, 313, 313],
     "ACAD_TABLESTYLE": [2, 1, 42, 42],
     "": [2, 0, 0, 0],
     "": [2, 0, 0, 0],
     "AcDbVariableDictionary": [2, 1, 145, 145],
     "": [2, 0, 0, 0],
     "APPDATA": [2, 2, 1423, 1423],
     "": [2, 0, 0, 0],
     "": [2, 0, 0, 0],
     "ACAD_DETAILVIEWSTYLE": [2, 2, 1443, 1443],
     "ACAD_SECTIONVIEWSTYLE": [2, 2, 1444, 1444],
     "ACDB_RECOMPOSE_DATA": [2, 2, 1452, 1452],
     "AcDsDecomposeData": [2, 2, 1453, 1453]
     }
   },

As you will see there are many key values empty ("": [2, 0, 0, 0],). 
Well here are two point of view, the firt is the file .json is wrong and 
the solution is delete the problematic lines or the second is 
JSON.Reader no skip empty keys.

¿JSON objets support empty keys?

¿JSON objets support repeated keys?

Regards.


On 7/11/20 1:42, Bruce wrote:

> On 7/11/20 11:04 am, Martin wrote:
>> Hi,
>>
>> I want to decode some json files buy sometimes doesn't work an an 
>> error appear.
>>
>> Facing the inability to debug within the component(gb.util.web) I 
>> copy that into to the project in "./json_clon" directory, but again I 
>> couldn't see the error.
>>
>> ¿Some idea if the dwg.json is wrong or is the component?
>>
>> I attach the study sample (inside looking for the file dwg.json for 
>> do the testing)
>>
>> Tanks
>>
>> MB
>>
>>
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
> SyntaxError: JSON.parse: bad control character in string literal at 
> line 11300 column 7 of the JSON data
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


More information about the User mailing list