JSON Encoding of YANG Data Under RFC 7951

300-435 By islever Editorial Last updated

Short answer

A RFC 7951 defines the JSON encoding of data modeled with YANG, so the correct label is the RFC 7951 JSON encoding rather than YAML, XML, or Protobuf.

Question

What is JSON encoding of YANG data called?
  1. JSON encoding of YANG data per RFC 7951 Correct Answer
  2. YAML
  3. XML
  4. Protobuf

Key Takeaways

JSON encoding of YANG data is the RFC 7951 representation used when a YANG-modeled tree is serialized as JSON, commonly with the application/yang-data+json media type. Option A wins because RFC 7951 is the standard that names and defines that encoding, while YAML, XML and Protobuf describe different representations.

Expert Analysis

RFC 7951 is the specification that names JSON as the encoding for data modeled with YANG, so option A is the matching answer while XML, YAML and Protobuf label other representations.

XML would be the correct label only for the RFC 7950 mapping, not for a JSON payload

The alternative that deserves the closest look is C, because YANG did not begin as a JSON modelling language and its XML mapping is the older, NETCONF-native representation. If the artifact being described were an <rpc> or <config> body whose leaf values are wrapped in element tags, XML would be the accurate encoding label; RFC 7950 defines YANG 1.1 and its XML serialization, and NETCONF uses that representation in protocol operations. That condition is absent because the wording fixes the serialization as JSON, not merely as some standards-based rendering of a YANG tree. XML and JSON are peers under the YANG model, not synonyms: one is element-centric, the other member-centric. The namespace of the model is shared, but the surface syntax changes completely: angle brackets and closing tags on one side, quoted member names and commas on the other. The existence of a valid XML encoding therefore does not make C the name of the JSON encoding; it only proves that YANG is encoding-independent. An answer that swapped in XML would answer a different serialization decision and would fail the moment a client requested application/yang-data+json or parsed the response with a JSON library. The alternative becomes correct only when the requirement is about NETCONF's conventional XML payloads, which the stated JSON condition is not.

RFC 7951 supplies the exact name, media type and typing rules for the JSON encoding

The decisive condition is the pairing of a YANG data model with a JSON document, where the JSON member names and value types are not arbitrary but derived from the module's tree. RFC 7951 is titled “JSON Encoding of Data Modeled with YANG” and defines that mapping; it is the label that corresponds to option A. It covers more than putting braces around leaf names: it specifies how lists and leaf-lists become arrays, how an empty leaf is represented, how numbers and booleans retain JSON types, and how names are qualified with the module when needed. The most practical identifier is the media type application/yang-data+json, used by RESTCONF and other interfaces when they exchange YANG-modeled JSON. RFC 7950 is the companion XML mapping, so the number in the option is not decoration; it is the citation that separates the JSON encoding from its XML sibling. Option A wins because it names the standard that governs the requested encoding, whereas the other options name formats that do not answer the JSON requirement. It is therefore a precise standard citation rather than a generic description of JSON syntax.

YAML, XML and Protobuf each fail on a different requirement of a JSON YANG exchange

B (YAML): YAML is readable and appears in automation tooling, but no IETF standard defines it as the JSON encoding of YANG data; choosing it would replace the requested JSON grammar with indentation-based syntax and break JSON parsers and application/yang-data+json expectations. C (XML): XML is a genuine YANG encoding under RFC 7950 and remains central to NETCONF, but it produces tagged elements rather than JSON objects, so it cannot satisfy a request for JSON and would be rejected where the content type or client library requires JSON. D (Protobuf): Protobuf is a binary, schema-driven serialization used in telemetry and gNMI-style interfaces, not the RFC 7951 JSON mapping; selecting it would force a protobuf schema and decoder into a conversation that calls for JSON text. Each alternative is plausible only in a different transport or toolchain context, and none supplies the exact RFC 7951 label that the JSON requirement demands. The cost is not merely a wrong word on a slide: the wrong format changes the parser, the media type and the tooling that must handle the payload. A YAML document, an XML element tree and a protobuf message can each be valid in some automation context, but none of them is the RFC 7951 JSON encoding named by the option.

The choice materializes at the RESTCONF content-type negotiation and RFC 7951 serialization step

In an operational exchange, the decision takes effect before any payload is built: a client asks for YANG-modeled JSON by sending an Accept: application/yang-data+json header, or supplies one with Content-Type when posting configuration, and the server then serializes or parses the YANG tree under RFC 7951. That is the stage where the RFC number becomes visible. A list of interfaces appears as a JSON array; an empty leaf can appear as [null]; a numeric leaf arrives as a JSON number rather than a quoted string; an identityref carries its module qualification. If a leaf name could collide across modules, RFC 7951 permits or requires the module-name:leaf-name form, which is a detail absent from the bare phrase “JSON encoding” but essential to interoperable payloads. This is also why the RESTCONF layer, not the YANG module itself, is where the encoding label is tested: the module declares the data structure, while the request metadata selects JSON and RFC 7951 determines its representation. Option A therefore names the rule set that the server and client actually apply at that boundary. A payload generated without those rules may look like JSON yet still be wrong for the model, which is why the standard citation in option A matters more than the generic word “JSON.”

Official Reference

Exam Strategy

Treat a YANG encoding item as two separate questions: what model is being represented, and which serialization rule set is being requested. Match the serialization to its RFC or media type before reading the distractors—RFC 7951 and application/yang-data+json for JSON, RFC 7950 and XML for NETCONF-style payloads. If the wording says JSON, eliminate YAML, XML, and Protobuf immediately, even though each can appear elsewhere in automation. This habit prevents a familiar format from overriding the exact encoding named in the stem.

Practice All 300-435 Questions

Access 150 questions with complete answers and detailed explanations.

View Full 300-435 Practice Test →

← Back to 300-435 Study Guide