Original post

Is JSON for computers or humans to read? Well, hopefully with this snippet it can be for both. Instead of just dumping all the json in one line, we instead format it and indent it for readability purposes.
Using the MarshalIndent function in the json package we’re able to not only specify the data to encode, but also a prefix and an indentation string. In our example we’re not to worried about the prefix, but the indentation (3rd parameter) allows us to structure our code.