We can use json.MarshalIndent() function instead of the json.Marshal() function to print JSON in a more readable format. We pass two additional arguments, prefix string and the indent string to MarshalIndent.