Support JSON5 in JSON Field #3857
nathanclevenger
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
JSON5 (https://json5.org) is an extension to the popular JSON file format that aims to be easier to write and maintain by hand (e.g. for config files)
JSON5 was started in 2012, and as of 2022, now gets >65M downloads/week, ranks in the top 0.1% of the most depended-upon packages on npm, and has been adopted by major projects like Chromium, Next.js, Babel, Retool, WebStorm, and more. It's also natively supported on Apple platforms like MacOS and iOS.
Formally, the JSON5 Data Interchange Format is a superset of JSON (so valid JSON files will always be valid JSON5 files) that expands its syntax to include some productions from ECMAScript 5.1 (ES5). It's also a subset of ES5, so valid JSON5 files will always be valid ES5.*
I would propose adding JSON5 support to the JSON field in Payload, so that a more permissive set of JSON & Javascript code can be accepted without error into a JSON field.
By replacing
JSON.parse
andJSON.stringify
in the JSON field here and here, it would be a fairly simple change.If this is acceptable to the core team, I would be happy to do a PR to implement this.
Beta Was this translation helpful? Give feedback.
All reactions