JNCIA-DevOps Data Serialization Practice Question
An engineer needs to convert an existing YAML-formatted inventory file into JSON format using a Python script. Which workflow accomplishes this transformation?
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
✓
Load YAML with yaml.safe_load() and serialize to JSON with json.dumps().
To convert YAML to JSON, the engineer must read and parse the YAML file into a Python data structure using yaml.safe_load(), and then serialize that structure into a JSON string using json.dumps().
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Directly pass the YAML file object into json.load().
Why it's wrong here
Incorrect. json.load() cannot parse YAML syntax directly.
- ✗
Rename the file extension from .yaml to .json.
Why it's wrong here
Incorrect. File extensions do not change the underlying text serialization format.
- ✓
Load YAML with yaml.safe_load() and serialize to JSON with json.dumps().
Why this is correct
Correct. Parsing YAML into native Python objects allows them to be re-serialized into JSON.
- ✗
Use yaml.safe_dump() directly on the JSON output stream.
Why it's wrong here
Incorrect. This converts Python/JSON to YAML, not YAML to JSON.
About these practice questions
Courseiva writes every JNCIA-DevOps question from scratch — 307 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official Juniper Networks exam blueprint
This JNCIA-DevOps practice question is part of Courseiva's free Juniper Networks 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 JNCIA-DevOps exam.