json5 / json5-spec

The JSON5 Data Interchange Format
https://spec.json5.org
MIT License
49 stars 11 forks source link

[due to a wrong assumption] non-ASCII key names without surrounded by `"` #39

Closed tats-u closed 2 years ago

tats-u commented 2 years ago

If JSON5 supports non-ASCII key names like JS, it will be more friendly for non-English users who is not good at English or programming.

$ node
Welcome to Node.js v14.15.4.
Type ".help" for more information.
> console.log({あ: 1})
{ 'あ': 1 }
jordanbtucker commented 2 years ago

Thanks for the suggestion. JSON5 already allows for unquoted non-ASCII property names.

Property names can start with any character in the Unicode categories "Uppercase letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter (Lt)", "Modifier letter (Lm)", "Other letter (Lo)", or "Letter number (Nl)".

Since あ belongs to the "Other letter (Lo)" category, your example is already valid JSON5.

tats-u commented 2 years ago

So it is an online formatter issue. Thank you for the information.

jordanbtucker commented 2 years ago

Which online formatter is reporting an error?

tats-u commented 2 years ago

@jordanbtucker Sorry I tried to find it but I could not. I found the other formatters that can be found in Google work well. I wonder where it has gone.