Earlier quoted context omitted.
That was their point, you inevitably have to escape one or the other, so just pick one
My only disagreement is that you imply that this is no better than plain old JSON – I think it's positively _worse_. It makes it difficult to remember which of the two quote marks to escape, without checking the beginning of the string to see what quote marks were there (and this difficulty exists not only for humans but for machines, which introduces more complexity in parsers). The benefit of JSON is that it's simp…
JSON5 Data Interchange Format
81–90 of 157 posts
Re: JSON5 Data Interchange Format
#82Having comments is probably the functionality I wanted the most.
Re: JSON5 Data Interchange Format
#83Earlier quoted context omitted.
It allows you to put double quotes in the string without escaping them, which is pretty nice.
But then you can't include single quotes into the string any more. Same problem again. The most practical solution for this problem I saw was in F#. You can use tripple-quoted strings. let a = """The diner is called "John's", but you can't let the string end with a double quote""" https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...
Re: JSON5 Data Interchange Format
#84Earlier quoted context omitted.
My only disagreement is that you imply that this is no better than plain old JSON – I think it's positively _worse_. It makes it difficult to remember which of the two quote marks to escape, without checking the beginning of the string to see what quote marks were there (and this difficulty exists not only for humans but for machines, which introduces more complexity in parsers). The benefit of JSON is that it's simp…
I didn't imply that, in fact my comment agrees with what you are saying. Did you reply to the wrong person?
Re: JSON5 Data Interchange Format
#85JSON is one of those formats that's "good enough" even if it's stinky and it's also universally accepted that a small iteration on it with small conveniences doesn't make that much sense imho.
Re: JSON5 Data Interchange Format
#86The JSON5 Data Interchange Format (https://spec.json5.org/) - 2 Years ago - 0 Comments - https://news.ycombinator.com/item?id=21113613
Re: JSON5 Data Interchange Format
#87Earlier quoted context omitted.
It allows you to put double quotes in the string without escaping them, which is pretty nice.
An annoying half-solution that breaks down as soon as you encounter content with both. Better imho to have one way and become good at it. I think I might even prefer trailing commas to be mandatory.
Re: JSON5 Data Interchange Format
#88Re: JSON5 Data Interchange Format
#89Re: JSON5 Data Interchange Format
#90Earlier quoted context omitted.
It would lose its "backwards compatible" property though.
Having a defined, predictable behaviour in JSON5 doesn't seem like it would break backwards compatibility with JSON's undefined, unpredictable behaviour. I don't think someone with an existing JSON document would complain that a JSON5 parser behaved "too predictably" when interpreting their document.