Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Should fail or warn on duplicate field name #8

Open
benkant opened this issue Nov 17, 2011 · 2 comments
Open

Should fail or warn on duplicate field name #8

benkant opened this issue Nov 17, 2011 · 2 comments

Comments

@benkant
Copy link

benkant commented Nov 17, 2011

When I validate the following code on JSONlist.com:

{
    "keya": 1,
    "keyb": 0,
    "keya": 0
}

It reports valid JSON. The last value "keya" is taken and the previous is ignored. Some JSON libraries do the same, but AFNetworking in particular fails for duplicate field names.

JSlint reports:

Problem at line 4 character 5: Duplicate 'keya'.

"keya": 0

JSON: bad.

@gillyspy
Copy link

if you do something like this:

{"function": {"replace": {"column": "NAME", "esc_string": "-", "esc_string":"_"}}}

then it will call it valid but the reformatting engine will drop the duplicate. I think it should just warn cuz this is valid JSON for us, but the reformat should not drop the dup for you

@esuomi
Copy link

esuomi commented May 28, 2012

Just hit this, not the worst of issues but it did catch me off guard. Fix would be nice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants