JSON
"JSON (JavaScript Object Notation) is a lightweight data-interchange format." - https://www.json.org/
See also
- toml: "TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics."
- yaml: Better human readability, more options.
Is YAML a superset of JSON?
Many people say that JSON is a subset of YAML, but that is not strictly true. See https://metacpan.org/pod/JSON::XS#JSON-and-YAML
Here's an example of json that does not work as yaml:
$ sed 's/\t/--->/g' break-yaml.json
--->{
--->--->"list": [
--->--->--->{},
--->--->--->{}
--->--->]
--->}
$ jq -c . break-yaml.json
{"list":[{},{}]}
$ json-to-yaml.py break-yaml.json
list:
- {}
- {}
$ yaml-to-json.py break-yaml.json
ERROR: break-yaml.json could not be parsed
while scanning for the next token
found character '\t' that cannot start any token
in "break-yaml.json", line 1, column 1
$ sed 's/\t/ /g' break-yaml.json | yaml-to-json.py
{"list": [{}, {}]}
Links
- https://goessner.net/articles/JsonPath/index.html: JSONpath is used by kubernetes as a native way to restructure
kubctl
output. - https://stedolan.github.io/jq/: jq is generally useful for working with JSON in a shell.
- http://jmespath.org/: jmespath is used in AWS APIs to restructure data.
- https://json5.org/: Now with trailing comma and comment support!
- https://github.com/antonmedv/fx: TUI with clickable expansion and search features, written in golang.
- https://github.com/TomWright/dasel: Universal serialized data tool, supports json, yaml, csv, and more.
- https://github.com/josephburnett/jd: "jd is a commandline utility and Go library for diffing and patching JSON and YAML values. It supports a native jd format (similar to unified format) as well as JSON Merge Patch (RFC 7386) and a subset of JSON Patch (RFC 6902)."
- https://www.jsonfeed.org: "The JSON Feed format is a pragmatic syndication format, like RSS and Atom, but with one big difference: it’s JSON instead of XML."