Re:Never use a dependency that you could replace with an aft...
by JackFr on Tuesday August 11, 2020 @07:43PM
(#24127233)
It may not be JSON but it’s out there in the wild. A lot.
Let’s say I’m scraping a website. I can:
1) complain to the owner that “it’s not JSON”.
2) write a parser for a syntax that has no spec, (it’s not JSON, but it sure looks an awful lot like JSON with unquoted keys.)
or
3) Set ALLOW_UNQUOTED_FIELD_NAMES to true in the Jackson library.
Re:Never use a dependency that you could replace with an aft...
by Izkata on Tuesday August 11, 2020 @11:38PM
(#24128388)
> Maybe a JS snippet.
While acceptable, also misleading: JS only does string keys, but unlike JSON it'll convert whatever it's given into strings. Not a problem most of the time, since it'll do the same conversion for both accessing and setting, but good to be aware of if you're doing something like iterating Object.keys()
Re:Never use a dependency that you could replace with an aft...
by jimmynest on Wednesday August 12, 2020 @12:14PM
(#24133530)
I use https://jsonformatter.org/json-parser sometime to parse json and to validate.
(Some JSON libraries do have option flags, but usually it's about whether, during deserializing into a known type, unknown fields are an error or silently ignored. Or whether C-style comments are an error or considered as whitespace.)