3 ms·
JSON sucks as a format. You forgot to mention the lack of optional commas, and the need to quote keys. However 'jq' is absolutely great, and that unfortunatel
by rwmj 4y ago
JSON sucks as a format. You forgot to mention the lack of optional commas, and the need to quote keys.
However 'jq' is absolutely great, and that unfortunately is why we used it for some command line tools that had to output structured data.
- bazoom42 4y ago“As a format” depends on what you use it for. No comments and simple syntax is great for an interchange format but a drawback for a configuration file format.
- butlerm 4y agoThe problem is json is not a simple format. In one major respect it is more difficult to generate than XML. The inability to handle commas as terminators rather than separators is a disaster that immensely complicates generating arbitrary json. That aspect only appears to be useful with trusted documents and dangerous eval style processing in Javascript in the first place. Of course it originated as JavaScript Object Notation, but it has significant downsides even as a replacement for a restricted dialect of XML. It is (regrettably) both difficult to read and difficult to generate by comparison. The absence of support for comments is a problem for ubiquitous use for configuration files as well.
- bazoom42 4y ago> The inability to handle commas as terminators rather than separators is a disaster that immensely complicates generating arbitrary json. This is a bit over the top. At worst you need a flag to special-case the first item.