Use this when automation reads or writes JSON, YAML, XML or CSV.
Data Formats
Data formats such as JSON, YAML, XML and CSV are how automation tools exchange structured data — API payloads, inventories, playbooks, reports — so parsing and validating them correctly is essential.
1. Data formats: JSON (APIs), YAML (config), XML (NETCONF/legacy), CSV (tabular).
2. Validate syntax and schema.
3. Know type pitfalls per format.
4. Use proper parsers, not regex.
5. Convert with tools (yq, jq).
data → parser → validation → automation
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Record document/source revision, record/object path, schema/version and consumer/run identity; inspect the runtime/control-plane result; then query the parsed in-memory model and the downstream configuration/API object produced from it through an independent read path and compare it with the versioned intent.
Step 2 Where it fails Narrow the fault
Common failure classes include encoding/BOM issues, delimiter/quoting ambiguity, duplicate keys, namespace drift, scalar coercion, invalid schema assumptions and parser success without consumer-valid semantics. Before retrying a mutating operation, read current target state using the stable identity document/source revision, record/object path, schema/version and consumer/run identity; if state is unknown, stop broad retries.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
JSON is the standard data format for APIs and many tools: objects of key-value pairs, arrays, strings, numbers, booleans and null.
Subtopic YAMLYAML is a human-friendly data format based on indentation, used for Ansible playbooks, Kubernetes manifests, CI pipelines and Compose files.
Subtopic XMLXML is a markup format with nested elements and attributes, used by NETCONF, SOAP, Windows configs and many enterprise systems.
Subtopic CSVCSV (comma-separated values) stores tabular data as text rows, easy to export from spreadsheets and import into scripts with Import-Csv or Python's csv module, but with no data types or nesting.
- Use real parsers, never string splitting.
- Validate structure before using the data.
- YAML type guessing causes surprises.
jq . file.json— JSON validyamllint file.yaml— YAML lintxmllint --noout file.xml— XML well-formed
ReferenceWhy it matters1 section · depth on demand
In depth
Data formats are how automation exchanges structured information: inventories, variables, API payloads, configuration and reports. Choosing the right format and handling it correctly avoids a large class of errors.
| Format | Strengths | Typical use |
|---|---|---|
| JSON | Strict, universal, API standard | REST APIs, machine output |
| YAML | Readable, comments | Ansible, Kubernetes, CI pipelines |
| XML | Schemas, namespaces | NETCONF, legacy enterprise APIs |
| CSV | Spreadsheet-friendly | Bulk imports/exports |
| TOML/INI | Simple configuration | Tool settings |
General rules: parse with real libraries (never regex), validate structure with schemas, convert types explicitly, and keep machine-generated files sorted and consistently formatted so Git diffs show only real changes.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Its durable intent is versioned document/schema/encoding contract with explicit field, type and validation rules; the stable identity contract is document/source revision, record/object path, schema/version and consumer/run identity. The consumer-visible target is the parsed in-memory model and the downstream configuration/API object produced from it. The operating invariants are that encoding and delimiters/namespaces are explicit, types are not silently coerced, schema/required fields are validated and serialized output round-trips predictably. Follow the chain of components bytes/text → decode → lexical parse → structural parse → schema/type validation → application mapping → downstream target and record which layer currently owns truth.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Data Formats. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/enable-automation · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture at minimum source/revision, encoding, record/path, parser/schema version, parsed type/value, validation diagnostics, line/column/path and downstream object ID.