Comment 5 for bug 2029482

Revision history for this message
Andrew Johnson (anj) wrote :

Does that work okay for you though?

Quotes are optional in JSON-5 for map keys that meet the requirements for an identifier, so the yajl generator checks map keys and only uses quotes when they're needed. A JSON-5 parser that accepts NaN values should also accept unquoted keys. An older JSON parser would not allow them, but then it should also reject Infinity and NaN as numeric values.

I did suggest in my GitHub PR the alternative solution of providing a separate "-M json5" mode, but that idea would require rather more work. If unquoted keys are a problem though I would raise that suggestion again and also have the strict JSON generator convert NaN and Infinity values into strings.