CSV and JSON files · 10 / 15 Exercise Easy

Reading a JSON object

Objective

Create a Python program that reads a JSON object and shows some of its data with the json module.

Instructions

  • Read a line with a JSON object with the keys name (text), age (number) and hobbies (list of texts).
  • Convert it into a Python dictionary with json.loads.
  • Show three lines: Name: N, Age: A and Hobbies: K, where K is the number of hobbies.
Input
{"name": "Ana", "age": 30, "hobbies": ["leer", "correr"]}
Output
Name: Ana
Age: 30
Hobbies: 2

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise