[Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

Michael Van Canneyt michael at freepascal.org
Sat Aug 31 16:57:07 CEST 2019



On Sat, 31 Aug 2019, Luca Olivetti via lazarus wrote:

> El 31/8/19 a les 16:22, Michael Van Canneyt via lazarus ha escrit:
>> 
>> 
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse 
>> 
>> 
>> Also frequently encountered is omitting "" around property names. JSON is a
>> subset of Javascript:
>> 
>> D.Parse('{ d: 12345678.3 }');
>
>
> The parser at mozilla says: "Error: JSON.parse: expected property name 
> or '}' at line 1 column 3 of the JSON data"

I know. But if you treat it as Javascript e.g.
b = eval('{ d: 12345678.3 }');
it does work. JSON is a subset of Javascript.

That is why I said "frequently encountered". Not all parsers handle & allow it.
But ExtJS for instance handles&produces it. (I used ExtJS and had to add it for that)

On large JSON files this shaves off quite some bytes off the result, I guess
that is why they did it. (not that it helped, an ExtJS JSON Store is dead slow.)

Michael.


More information about the lazarus mailing list