Data Formats
The Digital.ai Agility API supports three primary data formats for requests and responses: JSON, XML, and YAML. Each format has specific characteristics and use cases.
JSON (JavaScript Object Notation)
JSON is an acronym for JavaScript Object Notation. It is a light-weight data interchange format that is the native serialization format of JavaScript and can be handled "out of the box" by many languages. JSON delimits structures with curly braces, square brackets, and quotes. White space is ignored and indentation is irrelevant.
Characteristics:
- Lightweight and compact
- Native JavaScript format
- Wide language support
- Easy to parse programmatically
External Resources:
XML (Extensible Markup Language)
Extensible Markup Language is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
Characteristics:
- Strong validation capabilities
- Hierarchical structure
- Widely adopted standard
- Good for complex data structures
External Resources:
YAML (YAML Ain't Markup Language)
YAML is a recursive acronym for "YAML Ain't Markup Language". It is a human-friendly data serialization standard for all programming languages. YAML is a super set of JSON, and offers a lighter-weight, indentation-based syntax, similar to writing an outline in a text editor.
Characteristics:
- Human-friendly syntax
- Superset of JSON
- Indentation-based structure
- Minimal delimiters
- Suitable for hand-written configurations
YAML delimits structures with indentation, dashes to indicate sequence items, or lack thereof to indicate a mapping entry. The syntax is minimal and it is important to keep track indentation. In contrast to JSON and XML, YAML is more suitable for hand-written data using simple text editors.
External Resources:
Choosing a Format
| Format | Best For | Characteristics |
|---|---|---|
| JSON | Programmatic integration, REST APIs, JavaScript applications | Compact, easy to parse, wide support |
| XML | Enterprise integrations, complex validations, SOAP services | Strongly typed, validation support, hierarchical |
| YAML | Configuration files, human editing, query definitions | Readable, minimal syntax, superset of JSON |