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.
Start practicing
Data Serialization — choose a session length
Free · No account required
Domain overview
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.
Exam objectives
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
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.
Click any question to see the full explanation and answer options, or start a focused practice session above.
An 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?
2A 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?
3An 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?
4A 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?
5You 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?
6Which of the following data types is natively supported in JSON without requiring custom serialization handlers?
7Which character is used to indicate a mapping key-value pair in YAML syntax?
8Which file extension is conventionally used for YAML data serialization files?
9Which of the following characters is used to start a comment line in a YAML document?
10An 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?
11An 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?
12When 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?
13A 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?
14An 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()?
15What type of brackets enclose an array in a JSON document?
16A 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?
17An 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?
18When 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?
19An 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?
20You 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?
21Which Python module is part of the standard library and provides functions to serialize and deserialize JSON data?
22An 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?
23An engineer needs to convert an existing YAML-formatted inventory file into JSON format using a Python script. Which workflow accomplishes this transformation?
24You 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?
25Which Python function deserializes a JSON-formatted string into a native Python dictionary?
26Which of the following describes the fundamental structural difference between JSON and YAML regarding syntax design?
27A 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?
28An automation engineer needs to include comments explaining complex network parameters inside a Junos automation data file. Which serialization format should the engineer select?
29You 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?
30Which of the following valid JSON values represents a boolean true state?
31What is the native data format returned by Junos devices when queried via REST API or NETCONF operations configured with JSON output formatting?
32An 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?
33A 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?
34An 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?
35You 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?
36Which of the following primitive data types is NOT supported natively in JSON?
37Which TWO of the following are valid primitive data types in JSON? (Choose two)
38An 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?
39You 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?
40Which TWO of the following are valid extensions commonly used for YAML files? (Choose two)
41Which TWO methods are provided by the Python standard library 'json' module for deserializing JSON data? (Choose two)
42Which TWO features are supported by YAML but are notably absent in standard JSON? (Choose two)
43When 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)
44Which TWO of the following are valid scalar values in a YAML document? (Choose two)
45Which 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)
46Which TWO characters or sequences are valid in YAML for representing lists or sequences? (Choose two)
47When 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)
48When 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)
49An 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?
50An 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?
51You 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?
52An 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?
53During 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?
54An 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)
55An 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?
56An 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)
57A 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?
58An 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.)
59An 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?
60A 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?
61An 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?
62An 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.)
63An 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?
64An 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?
65An 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.)
66An 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?
67An 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?
68An 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?
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.
The Courseiva JNCIA-DevOps question bank contains 68 questions in the Data Serialization domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Data Serialization domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included