Editor

Create Pretty JSON

Intermediate · Write the code · from Python JSON: Parse, Create, and Manipulate JSON Data

From the lesson: Python JSON: Parse, Create, and Manipulate JSON Data

Imagine a universal language that every app, website, and database can understand. That's JSON (JavaScript Object Notation). It's the most popular format for sending data between computers.

Read the lesson

Create a Python dictionary with keys 'name' (value 'Alice'), 'age' (value 25), and 'hobbies' (value ['reading', 'hiking']). Convert it to a pretty-printed JSON string with 2-space indentation and print it.

import json
# Your code here

More JSON exercises

All Python exercises · 50 practice problems · File I/O & Data Formats quiz