DA0-002 Data Acquisition and Preparation Practice Question
A data analyst needs to extract data from an API that returns JSON. The analyst wants to convert the JSON output into a tabular format for analysis. Which function in a scripting language is commonly used for this purpose?
⚠ Common exam trap
Watch out — candidates often confuse `read_json()` (which works only for flat JSON) with `json_normalize()` (which handles nested structures), leading them to choose option C when the API response contains hierarchical data.
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_normalize()
`json_normalize()` is a function in the pandas library specifically designed to flatten semi-structured JSON data (including nested lists and dictionaries) into a tabular DataFrame. This makes it the ideal tool for converting API responses with complex nesting into rows and columns for analysis, unlike simpler JSON parsing functions.
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.loads()
Why it's wrong here
This parses JSON but does not flatten it into a table.
- ✗
to_csv()
Why it's wrong here
This exports data to CSV, not for parsing.
- ✗
read_json()
Why it's wrong here
This reads JSON into a DataFrame but does not handle nested structures automatically.
- ✓
json_normalize()
Why this is correct
This function normalizes semi-structured JSON data into a flat table.
Go deeper
Related to this question
About these practice questions
This DA0-002 question is part of Courseiva's 986-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DA0-002 practice question is part of Courseiva's free CompTIA 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 DA0-002 exam.