Python

Pretty print JSON in Python

Pretty print JSON or dict objects in Python. It is much easier to understand JSON objects that have nice indentation.

json

Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

In the below recipe, we assume that you have following variables available in your notebook:

  • my_dict (type dict)
  • data_json (type dict)

Python code

# Python code will be here

Code explanation

The above code displays JSON with pretty indentation (4 spaces).