[GTALUG] Extracting data from JSON file

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Wed Jul 24 16:03:42 EDT 2019


On Sat, Jul 20, 2019 at 09:56:53AM -0400, Stewart C. Russell via talk wrote:
> Wait, are you saying that the JSON has duplicate hash keys, like this:
> 
>     {"blort":"squarnk","mlem":-8,"blort":"phweeen"}
> 
> (so, two values for the key "blort")? It really shouldn't do that, even
> though the file is valid JSON. Most JSON parsers only return the last value.

RFC7159 says "names within an object SHOULD be unique".  So it isn't
REQUIRED, but implementations are not required to do something you would
like with duplicates and as you have seen most implementations use the
last entry seen and doing it is very much not recommended.

-- 
Len Sorensen


More information about the talk mailing list