CodeFaster

CodeFaster

json-format

Tyler Adams's avatar
Tyler Adams
Jan 12, 2021
∙ Paid
1
Share

In this post, we’ll go over how to use json-format, an easy to use CLI tool to format json.

Why use json-format?

If you work with json and use git, you’ll want json-format. json-format formats json to make the git-diffs as clear as possible.

If a json file’s json value hasn’t changed, then its git diff will be empty. No more dealing with a change in white space. No more dealing with a different key ordering.

If a json file’s json value has changed, then there will only be one difference per line. Since git diffs are line based, each entry change in an array or object corresponds to a single line change. This makes diffs a pleasure to read. One change stays on one line. No line changes because one of three values changed.

What is formatted json?

Formatted json sounds good. Who wants ugly json? But…what is formatted json? For this post, we’ll say it’s the output of jq -S (ignoring color) for an inputted json value.

The output that satisfies two important properties:

  1. If two formatted json val…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Tyler Adams
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture