Skip to content

Json specs and extensions

  • Good overview: Awesome JSON - What’s Next?
  • HuJSON
    • comments + tailing commas
    • impelments the JWCC extension
    • Keys need to be quoted !
  • jsonc: json like config with comments
  • hjson "Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. It's intended to be used like a user interface for humans, to read and edit before passing the JSON data to the machine."
  • json5: JSON5 is an extension to the popular JSON file format that aims to be easier to write and maintain by hand (e.g. for config files).
  • jsonl: Newline delimited JSON
  • ndjson Newline Delimited JSON

Convert jsonc to json

sudo pacman -S python-json5

cat ~/.config/waybar/config.jsonc | pyjson5 --as-json | jq

Convert jsonl to json

jsonl -> json:

jq -s '.' input.jsonl > output.json

json -> jsonl:

jq -c '.[]' input.json > output.jsonl