Closed Kaljurand closed 10 years ago
Probably the tool expects key names to be quoted, smth that is considered generally optional.
I guess the important part is that output files generated by the programs are compatible with the tools (keys are quoted). Programs accept input files with both quoted and unquoted keys.
The JSON standard does not consider quotes to be optional, in fact, they need to be there! Quoting from the ECMA-404 The JSON Data Interchange Standard (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf):
A JSON value can be an object, array, number, string, true, false, or null. An object structure is represented as a pair of curly bracket tokens surrounding zero or more name/value pairs. A name is a string. A string is a sequence of Unicode code points wrapped with quotation marks (U+0022).
Thus, the only tokens not needed to be enclosed with quotation marks are numbers and the tokens true, false and null. Arrays need to be enclosed with [ ] marks.
Please don't keep closing the Issue threads before solving them!
Yesterday, I closed an issue briefly before pushing the fix. I learned my lesson, today I did it in right order, so it would have been nice if you had checked it before commenting..
I don't see that silently accepting non-quoted strings in input is conforming to the standard. So the test files were not generated by the program? If the output is always conformant, it's good.
When merging a pull request, you can add either: closes #IssueNumber or fixes #IssueNumber To make the fixing/closing of the issue more visible.
Yes, test files are for program input, not its output. So, as:
I would prefer not to continue with this thread :)
Fine. Great that output is truly standards compliant.
A recommended way of pretty-printing JSON files is Python's
json.tool
(see e.g. http://stackoverflow.com/questions/352098/how-can-i-pretty-print-json). The JSON files included as examples of input formats are not compatible with this tool.