JNCIA-DevOps · domain
Data Serialization
This domain covers data serialization formats used in Junos automation: JSON, XML, and YAML. It tests how these formats are parsed and produced by Python scripts interacting with Junos devices via NETCONF, REST, or telemetry, focusing on syntax rules, data type mapping, and structural conversion pitfalls.
Focused practice
Practice Data Serialization questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about Data Serialization
Candidates must parse and generate JSON, XML, and YAML in Python for Junos automation, ensuring correct data type mapping and structure preservation. The most important thing is to handle format-specific rules, such as JSON's strict syntax and XML-to-JSON conversion challenges, without data loss.
Parsing Junos telemetry JSON with json.loads() and mapping JSON types to Python types
Converting Junos XML operational state from NETCONF into JSON without losing sibling elements
Identifying valid JSON syntax and data types in automation workflows
Handling JSON parsing errors such as trailing commas in configuration files
Watch out for
Common Data Serialization exam traps
- ▸Assuming JSON keys can be integers; JSON object keys are always strings, but Python json.loads() may convert numeric-looking keys to integers.
- ▸Forgetting that XML sibling elements with the same tag become duplicate keys in a naive JSON conversion, causing data loss.
- ▸Believing trailing commas are allowed in JSON; they cause json.load() to raise a JSONDecodeError.
Question index
All Data Serialization questions (68)
Click any question to see the full explanation, or start a practice session above.
An engineer needs to convert an existing YAML-formatted inventory file into JSON format using a Python script. Which workflow accomplishes this transformation?
Medium2You are writing a Python automation tool that reads telemetry data from a Junos device. The data is received as a JSON string containing forward slashes escaped as '\/'. When you load this string using json.loads(), how does Python handle the escaped slashes?
Hard3An automation engineer wants to log structured data from a Junos device automation run. The Python script formats a dictionary into a JSON string and prints it. However, the engineer wants all keys sorted alphabetically to ensure consistent log diffing. Which parameter accomplishes this in json.dumps()?
Medium4An automation engineer writes a Python script that reads a Junos configuration exported as JSON and uses json.loads to parse it. The script then searches for a key named "interfaces". The JSON document contains two objects at the same nesting level, each with an "interfaces" key, because the configuration was merged from two sources. What will json.loads produce, and how should the script handle it?
Hard5When writing a Python script to interact with a Junos device via PyEZ, you receive an object representing RPC output. You want to serialize a custom Python class instance containing device metadata into JSON, but calling json.dumps() raises a TypeError. What is the standard approach to resolve this?
Hard6Which of the following primitive data types is NOT supported natively in JSON?
Easy7An automation engineer is designing a data model for Junos device inventory that will be serialized to JSON and consumed by multiple tools. The engineer wants to include a null value, a boolean, and a string that contains a colon and a space. Which TWO statements correctly describe JSON serialization rules that apply to this model? (Choose two.)
Hard8An automation scripter needs to load a YAML configuration file in Python. To prevent arbitrary code execution vulnerabilities associated with untrusted files, which function should always be called?
Medium9Which TWO characters or sequences are valid in YAML for representing lists or sequences? (Choose two)
Easy10An automation engineer writes a Python script that reads a Junos configuration file serialized in JSON. The file opens successfully, but parsing fails with a JSONDecodeError due to trailing commas at the end of object lists. How does standard JSON handle trailing commas compared to YAML?
Medium11When 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?
Hard12An automation engineer is writing a Python script to parse a Juniper Junos NETCONF reply received in XML format and needs to convert it into a JSON structure for easier manipulation in a web application. Which built-in Python module is primarily used to handle JSON data serialization and deserialization?
Easy13An automation engineer uses a Python script to pull interface statistics from a Junos device through the Junos PyEZ Table and View framework. The View definition must map the XML element <name> to the Python attribute interface_name. Which PyEZ View syntax correctly performs this mapping?
Medium14You are writing a Python script that parses a multi-document YAML stream containing Junos device site configurations. One of the documents contains a custom YAML tag. When parsing with yaml.safe_load_all(), how does the safe loader handle custom tags?
Hard15An automation script reads interface names and VLAN IDs from a CSV file and converts each row into a JSON object before sending it to a Junos device REST API. Which Python module is specifically designed to parse CSV (Comma-Separated Values) files?
Medium16You are writing a Python automation script that reads a Junos configuration file in JSON format. The JSON file contains duplicate keys within the same object scope. According to the JSON specification RFC 8259, how should a conforming JSON parser handle duplicate keys?
Hard17An engineer receives a YAML configuration snippet for a PyEZ automation script, but the script fails with a parser error. Upon inspection, the error is caused by improper indentation levels. Which rule must be strictly followed regarding indentation in YAML syntax?
Medium18An automation engineer needs to convert a JSON payload representing Junos interface configurations into equivalent YAML format to reuse in an Ansible playbook. Which fundamental structural relationship between JSON and YAML makes this conversion straightforward?
Medium19An automation engineer is reviewing data serialization formats used within Junos automation workflows. Which TWO statements are correct regarding JSON syntax and data types? (Choose two)
Medium20During script development, an engineer encounters a YAML file containing comments and multiple configuration documents separated by document markers. Which characters are used to denote the start of a new document within a single YAML file stream?
Medium21A Python script retrieves interface statistics from a Junos device in JSON format, modifies a threshold value, and needs to output it back into a formatted JSON string with an indentation level of 4 spaces for readability. Which Python snippet achieves this?
Medium22An automation engineer needs to pretty-print a JSON payload in the Linux terminal for debugging Junos telemetry. Which built-in Python command-line utility can be invoked to validate and pretty-print a JSON file?
Medium23An automation engineer wants to verify the syntax of a large YAML playbook before executing it against a production Junos device. Which python one-liner command can be run in the terminal to quickly check if the file is syntactically valid YAML?
Medium24A Python automation script extracts routing table entries from a Junos device. The data structure contains deeply nested dictionaries and lists. The engineer needs to perform a deep copy of this deserialized JSON structure before modifying it. Which Python module provides the deepcopy function needed to duplicate nested containers safely?
Hard25A network automation script is reading a YAML configuration file containing Junos device credentials. The script encounters an unhandled exception when attempting to load the file using PyYAML. Upon inspection, the error is caused by a tab character used for indentation instead of spaces. Which YAML specification rule does this violate?
Medium26An automation engineer writes a Python script that loads a YAML file containing Junos device connection parameters. The file includes a line `timeout: 30` and another line `description: 30 seconds`. The script then uses the values in a template. Which statement correctly describes how a standard YAML parser will interpret these two scalar values?
Hard27Which TWO of the following are valid scalar values in a YAML document? (Choose two)
Easy28Which of the following valid JSON values represents a boolean true state?
Easy29An automation developer is examining a JSON response payload returned by a Juniper device via a REST API call. Which valid JSON data type is used to represent an ordered list of values enclosed within square brackets?
Easy30Which file extension is conventionally used for YAML data serialization files?
Easy31A Python script reads a Junos configuration snippet stored in YAML. The configuration uses YAML anchors and aliases to duplicate common routing policy definitions across multiple VRFs. When the script parses the file using yaml.safe_load(), what happens to the anchors and aliases?
Hard32Which of the following characters is used to start a comment line in a YAML document?
Easy33An automation engineer is writing a script that saves operational telemetry data gathered from a Junos router. The data needs to be written directly to an open file stream in JSON format. Which method from the Python 'json' module should be used?
Medium34An engineer needs to represent an ordered list of IP addresses in a YAML configuration file for a Junos automation playbook. Which valid YAML syntax correctly defines a sequence of items?
Easy35You are writing a Python automation script that processes JSON output from a Junos device's 'show interfaces' operational command via PyEZ. One of the interface descriptions contains raw control characters. When the script attempts to dump this data to a JSON string using json.dumps(), it raises a ValueError. Which parameter should you pass to json.dumps() to handle non-printable or out-of-range character encoding gracefully?
Hard36Which Python function deserializes a JSON-formatted string into a native Python dictionary?
Easy37An automation engineer is writing a Python script that takes a complex nested Python dictionary containing Junos telemetry parameters and converts it into a YAML string. Which PyYAML function should be used?
Medium38Which TWO features are supported by YAML but are notably absent in standard JSON? (Choose two)
Medium39When serializing complex nested Python dictionaries to JSON, which THREE data types will cause a TypeError unless handled by a custom default encoder function? (Choose three)
Hard40When writing an automation script that converts data formats between YAML and JSON for Junos configuration pipelines, which THREE potential pitfalls should an engineer account for? (Choose three)
Hard41An automation script reads a configuration template where boolean values are represented as 'yes' and 'no' in YAML. When parsed using PyYAML in Python, how are these values interpreted?
Medium42When serializing Python data structures to JSON for Junos automation payloads, which THREE parameters can be passed to json.dumps() to control formatting and readability? (Choose three)
Hard43An automation engineer needs to include comments explaining complex network parameters inside a Junos automation data file. Which serialization format should the engineer select?
Medium44You are writing a Python script using the PyEZ library to retrieve interface facts from a Juniper EX Series switch. The resulting data structure is stored in a Python dictionary. You need to dump this dictionary into a YAML file so it can be read by an Ansible playbook later. Which PyYAML function should you use to convert the Python dictionary into a YAML-formatted string or file stream?
Hard45A network automation team stores Junos device inventory in JSON. A developer notices that the JSON file contains a field "last_updated": "2024-05-01T12:00:00Z" and wants to compare it against the current time in a Python script. Which statement correctly describes how a standard JSON parser handles this value?
Medium46What is the native data format returned by Junos devices when queried via REST API or NETCONF operations configured with JSON output formatting?
Easy47An automation engineer is comparing YAML and JSON for storing Junos device configuration data. Which TWO statements accurately describe differences between the two formats? (Choose two.)
Hard48Which TWO of the following are valid primitive data types in JSON? (Choose two)
Easy49An automation engineer is building a Python script that generates Junos configuration snippets from a JSON payload. The payload contains nested objects representing interfaces, units, and addresses. The engineer uses json.loads and then accesses data['interfaces']['ge-0/0/0']['unit'][0]['family']['inet']['address'][0]['name']. Which JSON structural feature makes this nested access pattern possible?
Hard50A Python script processes a YAML configuration template for Junos BGP neighbors. The configuration contains a multi-line banner string description. Which YAML block scalar indicator preserves newlines exactly as written in the text block?
Hard51You are writing a Python automation script that processes configuration data. The script reads a YAML file containing Junos firewall filters, modifies them, and writes them back out. However, you notice that all the original comments in the file are stripped out in the output. What is the fundamental reason for this behavior in standard PyYAML dump operations?
Hard52What type of brackets enclose an array in a JSON document?
Easy53An automation engineer uses a Python script with the PyEZ library to retrieve interface statistics from a Junos device and wants to store the results in a file that preserves data types such as integers, booleans, and null values for later processing by another tool. The engineer needs a serialization format that is compact, widely supported by APIs, and preserves these primitive types. Which format should the engineer choose?
Medium54Which of the following describes the fundamental structural difference between JSON and YAML regarding syntax design?
Easy55An engineer writes a Python script that loads a JSON configuration file using the json.load() method. The file contains configuration parameters for a Junos device. If the JSON file contains a trailing comma at the end of the last element in an array, what will happen when the script executes?
Medium56You are writing a Python script that converts a Junos operational state output from XML (via NETCONF) into JSON. The XML structure contains sibling elements with the same tag name. When converted naively, how do standard XML-to-JSON conversion libraries (like xmltodict) typically represent these repeated sibling elements in the resulting JSON dictionary?
Hard57An automation engineer needs to parse a JSON payload returned by the Junos REST API that contains a list of interfaces, each with a name and a list of addresses. The engineer wants to iterate over the interfaces and then over each interface's addresses in Python. Which Python data structure mapping does the `json` module produce for this payload?
Medium58Which TWO methods are provided by the Python standard library 'json' module for deserializing JSON data? (Choose two)
Medium59Which character is used to indicate a mapping key-value pair in YAML syntax?
Easy60Which TWO Python standard library modules are commonly combined when a script needs to fetch web content (such as Junos REST API data) and parse the resulting payload? (Choose two)
Medium61An automation developer is designing a script that reads routing policy parameters from a configuration file. Which TWO data formats are natively supported and commonly used across Junos automation toolchains like PyEZ, Ansible, and REST APIs for data serialization? (Choose two)
Easy62A Python automation script parses a Junos telemetry stream in JSON. The JSON payload uses integer keys in a dictionary (e.g., {443: 'HTTPS'}). When loaded into Python using json.loads(), what data type do the dictionary keys become?
Hard63An automation engineer is designing a Python script that converts Junos device configuration data between JSON and YAML formats. The script must correctly handle data types to avoid misconfiguration. Which TWO statements about JSON and YAML data type handling are correct? (Choose two.)
Hard64Which of the following data types is natively supported in JSON without requiring custom serialization handlers?
Easy65A network automation engineer is using a Python script with the PyYAML library to load a YAML file that defines a Junos device's configuration. The script needs to ensure that the loaded data is a Python dictionary and that no arbitrary Python objects are instantiated during parsing. Which function should the engineer use to safely load the YAML content?
Medium66Which TWO of the following are valid extensions commonly used for YAML files? (Choose two)
Easy67Which Python module is part of the standard library and provides functions to serialize and deserialize JSON data?
Easy68An automation engineer stores Junos interface descriptions in a YAML file. One description includes the text 'Link: 10G uplink to core-sw-01'. After loading the file with a standard YAML parser, the engineer finds the value is not parsed as expected. Which YAML syntax should the engineer use to store this value correctly?
EasyOther domains
All JNCIA-DevOps exam domains
Frequently asked questions
- What does the Data Serialization domain cover on the JNCIA-DevOps exam?
- Candidates must parse and generate JSON, XML, and YAML in Python for Junos automation, ensuring correct data type mapping and structure preservation. The most important thing is to handle format-specific rules, such as JSON's strict syntax and XML-to-JSON conversion challenges, without data loss.
- How many questions are in this domain?
- This page lists all 68 Data Serialization questions in the JNCIA-DevOps question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only Data Serialization questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.