Introduction
CompactData is a compact data serialisation format. It is well suited to use cases where efficient data storage and transport is a priority.
CompactData is a data serialisation format (like JSON and YAML). CompactData prioritises efficiency of data above all else and is well suited to projects where efficient data storage and transport is a priority.
CompactData is a way to store and transmit data objects using human-readable text – a process known as data serialisation. Other well-known data serialisation formats are JSON and YAML. In comparison to JSON and YAML, CompactData is a more efficient way to store and transmit serialised data. For this reason, CompactData is a good choice for projects where efficiency is a high priority.
Similarities with JSON
Like JSON and most other data serialisation formats, CompactData is made up of:
- values like
a
,1
,true
,false
,null
- pairs consisting of a key and value
- maps containing pairs
- arrays containing values
Subtle differences to JSON
CompactData has the following subtle differences when compared to JSON:
- CompactData uses an equals (
=
) to split a key and value, whereas JSON uses a colon (:
) - CompactData uses a semi-colon (
;
) as a separator, whereas JSON uses a comma (,
) - It is not necessary to quote keys or values – types are inferred
- Values can be quoted using
`back ticks`
as well as"quotes"
Significant differences to JSON
CompactData has the following significant differences when compared to JSON, in the pursuit of efficiency:
- It is not necessary to split a key and value with
=
if the value is a map or an array, e.g:colours[red;blue]
,colours=[red;blue]
,person=(name=Alice)
andperson(name=Alice)
are all valid - Pairs can be expressed outside of a map at the top level, where they are considered pairs in the same map
- Pairs can be expressed as values in an array, where each pair is considered an individual map with a single pair
Learn More
To experiment with CompactData use the Playground, to use CompactData in your own project take a look at the Developer Libraries. For detailed information read the Technical Specification.