We're basically using JSON5 syntax, and while this is legal:
If the key contains (for example) a space we should encode like this:
So we should add quotes if the key name would be illegal with the quotes. This also includes empty keys, e.g:
{
"": "hello world, yes this is legal
}
Real world example:

We're basically using JSON5 syntax, and while this is legal:
If the key contains (for example) a space we should encode like this:
So we should add quotes if the key name would be illegal with the quotes. This also includes empty keys, e.g:
Real world example: