Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unquoted key name #13

Closed
wants to merge 2 commits into from
Closed

Conversation

odewdney
Copy link

Key names are sometimes not quoted - added support to the json_ParseKey

@timhall
Copy link
Member

timhall commented May 18, 2015

Is there a valid case where unquoted keys are allowed? Allowing single quotes is already outside the JSON standard (http://www.json.org/ calls for double-quotes only) and I'd rather not diverge too much from the standard if possible.

@odewdney
Copy link
Author

I have a webservice ( Amazon ) that is supplying unquoted keys. I would have thought that a parser should be fairly tolerant of its input, but also avoiding ambiguities. The unquoted key parser should really verify that the key is valid javascript identifier, but in my simple mod it is just looking for a space or ':' terminator. I have wrapped the mod in a check for a flag to enable the functionality of parsing 'simple' Javascript Object Literals.

I believe that it is useful in processing data supplied from third parties that you cant change.

@timhall
Copy link
Member

timhall commented May 19, 2015

Hi @odewdney thanks for the PR! I like the idea of hiding it behind an option flag, I'll look into it more and merge soon.

@timhall timhall mentioned this pull request Nov 5, 2015
@timhall timhall closed this in #16 Nov 5, 2015
@timhall
Copy link
Member

timhall commented Nov 5, 2015

@odewdney thanks again for the PR. I apologize it took me so long to get it merged. I've added a new JsonOptions property that has an AllowUnquotedKeys option for handling this and have used your code for parsing unquoted keys. Thanks!

@asopenag
Copy link

asopenag commented Jan 8, 2019

FYI: I've updated a simple fix on #121 to also handle not quoted values. It depends on the same JsonOptions.AllowUnquotedKeys option.

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

Successfully merging this pull request may close these issues.

3 participants