Unquoted numeric keys in JSON output
See original GitHub issuePrettier 1.19.1 Playground link
--parser json
Input:
{1:"a"}
Output:
{ 1: "a" }
Expected:
{ "1": "a" }
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Parsing json, key without quotes - Stack Overflow
Check the JSON syntax. The only unquoted entities allowed except for numbers, objects and arrays are null , true , false . So...
Read more >Must numeric JSON keys be quoted? - DBA Stack Exchange
I've noted that key-value values may be unquoted when numeric in TSQL JSON strings, but it seems the key component must always be...
Read more >How to parse unquoted JSON with JavaScript - Quora
JSON can be loaded into a JavaScript object by using the JSON.parse() function. JSON is valid JavaScript, so it can be placed into...
Read more >JSON Files - Spark 3.3.1 Documentation
Property Name Default Scope
primitivesAsString false read
prefersDecimal false read
allowComments false read
Read more >JSON methods, toJSON - The Modern JavaScript Tutorial
a number in JSON is just a number alert( JSON.stringify(1) ) // 1 // a ... There's another format named JSON5, which allows...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, I have no input on this. But I did think of #6132. Not sure if it is related.
But this is also an invalid input
{b:"a"}
It can be processed like this{"b":"a"}
Is it different from this?{1:"a"}
@thorn0