-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Hi,
I see that cJSON handles duplicate members by always returning the first matching member with the GetObjectItem
functions.
The JSON spec leaves handling of duplicate keys as an implementation detail. However, ECMA-262 EcmaScript specification, which is widely adopted by web browser JavaScript engines states:
In the case where there are duplicate name Strings within an object, lexically preceding values for the same key shall be overwritten.
In other words, the last value wins. Would there be interest in adding a configurable mode to cJSON to ensure interoperability with web application parsers by modifying the GetObjectItem
functions to return the last matching item in case of duplicates?
Metadata
Metadata
Assignees
Labels
No labels