Skip to content
CodeKruPro

Read objects, lists and nested JSON fields

Automation taskEasy

Interviewers often paste a JSON response and ask: "What is the city of the second address?" or "How many items are in the order?" You answer by reading a path through objects and lists. In this lesson you read real responses until those paths feel natural.

Read objects, lists and nested JSON fields

01 · Read and understand requests

Recommended first: Send your first API request

Your goal: Read objects, lists and nested JSON fields

Follow one request at a time. Send it yourself, then select that response before you answer.

  1. 1Send requests
  2. 2Submit answers

Start here: sign in to practise.

Jump to practice

What you will learn

JSON is a text format for data. Braces contain an object with named fields; square brackets contain a list. Quoted text is a string, unquoted numbers are numeric values and true/false are booleans. Missing and null are different.

Your goals

  • Read nested fields without writing code.
  • Identify data types and an absent field.

Before you start

Read the previous lesson first if you have not already. This course does not require programming.

Practice setup

These requests use the public TestKru teaching API. No workspace is needed unless a step says so. Leave the body empty for GET, HEAD and OPTIONS. Example people and emails are fictional. Changes to /api/users are simulated and are not saved.

Follow these steps

  1. Send the user request. Leave the body empty and select that response. It is one object, not the list from the previous lesson.
  2. Send the product request. In the body, open category and read the name inside it. Select that response.
  3. Send the book request. Find the name inside author, and look at the tags list. Select that response.
  4. Copy the category name and the author name from the responses you selected. Choose the JSON type of specs.inStock. Choose whether middleName is in the product.
  5. Submit Answers. If a check needs attention, open the response named in that check and correct that answer.

Investigate before concluding

First record the actual result for each case. Compare the body, headers and later state with the stated contract. Keep an observation separate from a prediction; use the model answer only after making your own attempt.

What to keep as evidence

  • All three different resources were read.
  • Nested values match the selected responses.
  • Boolean, array, null and absence are not confused.
References for this lesson

Finish this assignment

Select each named response with Use this response. Answer from those responses or the transcript on this page. Click Submit Answers. Your score is the percentage of checks that passed. Core checks are required to finish. Extra evidence checks are labelled. A saved 100/100 means every check passed. Continue opens the next lesson you can submit.

If something goes wrong
  • Change one part of the request at a time. If a check needs attention, read the note under it and compare it with the response you selected.
Self-review and independent variation
  • All three different resources were read.
  • Nested values match the selected responses.
  • Boolean, array, null and absence are not confused.

Read product 4 independently and explain why false is still a valid boolean.

Automatic checks verify the requests and answers configured for this lesson. The self-review is for your own reasoning. A score is not a certificate.

Open API reference

Practise and save your evidence

The lesson is public. Sign in to send requests and save progress. You will return to this lesson.

Sign in to practiseCreate an account