Courseiva

200-901 Software Development and Design Practice Question

A developer needs to parse a JSON string received from a REST API into a Python dictionary. Which function should they use?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

json.loads()

json.loads() converts a JSON string into a Python object (dict, list, etc.).

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    json.dumps()

    Why it's wrong here

    `json.dumps()` serialises a Python object into a JSON-formatted string, the opposite direction from parsing. It is tempting because it is the most familiar json function, and it would be correct when sending a dictionary to an API rather than decoding a response.

  • ✓

    json.loads()

    Why this is correct

    json.loads() deserialises a JSON-formatted string into a Python dictionary, satisfying the stem's requirement to parse an incoming REST API string. Its counterpart json.load() reads from a file object instead, so it would not work on the raw string the developer receives.

  • ✗

    json.load()

    Why it's wrong here

    `json.load()` deserialises from a file object, not a string, so passing the API response text raises an AttributeError when it calls `.read()`. It is tempting because it parses JSON into a dictionary, and it would be correct when reading JSON directly from an opened file.

  • ✗

    json.dump()

    Why it's wrong here

    `json.dump()` writes a Python object as JSON to a file object, performing serialisation rather than parsing. It is tempting because it handles JSON and dictionaries, and it would be correct when persisting a dictionary to a file instead of decoding an API response string.

About these practice questions

One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.