konklone / json

A free, in-browser JSON to CSV converter.
https://konklone.io/json/
Other
753 stars 211 forks source link

JSON5 support, and comprehensive tests and examples #224

Closed konklone closed 5 years ago

konklone commented 5 years ago

This pull request:

This means we now support:

For an example of what JSON5 supports, this is the canonical example from their README:

{
  // comments
  unquoted: 'and you can quote me on that',
  singleQuotes: 'I can use "double quotes" here',
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  positiveSign: +1,
  trailingComma: 'in objects', andIn: ['arrays',],
  "backwardsCompatible": "with JSON",
}

Putting the JSON5 example above into the JSON-to-CSV converter (as of this PR) parses this as expected and renders it:

screenshot from 2018-10-27 19-23-28

All tests produce the expected output.