To pretty print a messy JSON string, you can use the json.dumps() method of the built-in Python package named json. The json.dumps() method takes a number of parameters, including the indent level for the JSON arrays, which will be used to pretty-print the JSON data string. To pretty-print a JSON file, use the json.dump() paired method (without the "s"). In this Python Pretty Print JSON example, we load a minified JSON string and pretty print it using json.dumps() method. Click Execute to run the Python Pretty Print JSON example online and see result.