JNCIA-DevOps Data Serialization Practice Question
When converting a deeply nested JSON data structure representing Junos device health metrics into YAML using PyYAML, the output uses complex block styles that are difficult for team members to read. Which parameter in yaml.safe_dump() can force scalar values or containers to prefer flow style (JSON-like curly braces and brackets) instead?
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
✓
default_flow_style=True
The default_flow_style parameter in yaml.safe_dump() controls how collections are dumped. Setting default_flow_style=False uses block style, while True or None dictates flow style formatting.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
force_json=True
Why it's wrong here
Incorrect. force_json is not a valid argument in PyYAML.
- ✗
format='compact'
Why it's wrong here
Incorrect. format is not a parameter of yaml.safe_dump().
- ✗
style='flow'
Why it's wrong here
Incorrect. style is an argument for specific scalar representations, not a top-level dump argument.
- ✓
default_flow_style=True
Why this is correct
Correct. default_flow_style=True forces PyYAML to serialize collections in flow style (JSON-like syntax).
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.