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

Allow for decoding of non-quoted object identifier strings in a non-strict decode mode #37

Open
darronschall opened this issue Jul 28, 2010 · 9 comments

Comments

@darronschall
Copy link
Contributor

Originally filed by marcinhow on 2007-09-04T12:50:55

What steps will reproduce the problem?

  1. private var string: String = '[[{metadata:{fields:
    [{width:50,attrname:"NME_NIVEL_FORM",fieldtype:"string"},
    {width:4,attrname:"ANO_FORM",fieldtype:"string"}]},rowdata:
    [["Doutorado","2006"]],version:2.0}]]';
  2. var obj: Object = JSON.decode(string);
  3. Error: Unexpected m encountered: because metadata shoud be "metadata"

What is the expected output? What do you see instead?
I would like of one array:
private var array: Array = [[{metadata:{fields:
[{width:50,attrname:"NME_NIVEL_FORM",fieldtype:"string"},
{width:4,attrname:"ANO_FORM",fieldtype:"string"}]},rowdata:
[["Doutorado","2006"]],version:2.0}]];

What version of the product are you using? On what operating system?
0.9

@darronschall
Copy link
Contributor Author

Updated by mikechambers on 2008-07-02T16:40:54

Original ticket set status to Accepted (we converted to open)

@darronschall
Copy link
Contributor Author

Updated by darron.schall on 2008-10-23T02:15:29

This is a strict mode / non-strict mode change. When strict mode is turned off we
should allow for decoding of non-quoted object identifier strings.

It is not valid JSON to have object identifiers not have quotes. However, a lot of
other JSON lirabries seem to output these invalid strings by default.

So, when strict mode is ON, a parse error should be generated as is the current behavior.

When strict mode is OFF, we should process the identifier like it was a string even
if it isn't enclosed in quotes

Removed label Type-Defect
Added label Type-Enhancement
Added label strict
Title changed from 'Allow for decoding of non-quoted object identifier strings in a non-strict decode mode' to 'Allow for decoding of non-quoted object identifier strings in a non-strict decode mode'

@darronschall
Copy link
Contributor Author

Updated by mikechambers on 2008-11-07T19:28:43

Original ticket set owner to darron.schall

@darronschall
Copy link
Contributor Author

Updated by darron.schall on 2008-12-10T16:46:17

Issue 83 has been merged into this issue.

@darronschall
Copy link
Contributor Author

Updated by davidsarah.hopwood on 2009-06-04T22:16:23

I'm interested in which JSON libraries you know of that emit unquoted property
names. The es5-discuss mailing list is currently discussing whether the standard ES5
JSON parser will need to accept them.

@darronschall
Copy link
Contributor Author

Updated by evan_m...@sympatico.ca on 2009-07-12T01:07:34

Has this issue been resolved yet? Been expecting it to be resolved since last Winter
break...tried the latest version but to no avail

@darronschall
Copy link
Contributor Author

Updated by darron.schall on 2009-07-13T02:55:58

@evan - No, this has not been resolved yet. However, as long as you're using properly formatted JSON you
shouldn't run into trouble.

I'm still debating if this is really worth implementing because it goes against JSON syntax (per es5 discussions).
If a library claims to output JSON strings, then the library should be using quoted object keys.

@darronschall
Copy link
Contributor Author

Updated by evan_m...@sympatico.ca on 2009-07-13T14:21:08

@darron - Oh ok, thank you very much for your prompt reply. See we are working with
Moodle and the MySql database doesn't allow for quoted values to be stored. From
what I understand, that is one of the reasons why there is a demand and use case for
parsing non-quoted JSON strings.

Any chance we may re-consider? What options do you there are?

@yerboogieman
Copy link

I am working on modifying the com.adobe.serialization.json.JSON* classes to resolve this issue. Would you like the code?

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

No branches or pull requests

2 participants