Maps
Maps are simple key/value pair structures, they translate to JSON Objects.
Example
introduction = { "greeting": "hello", "subject": "world" }
Difference between Blocks and Maps
When translated to JSON, both Blocks
and Maps
become plain objects, they however differ in the following ways:
Blocks
- designed as a structural construct
- support @directives at their root
- cannot be piped
- tolerant syntax (commas are optional)
Example
block {
@directive
key = "value"
key2 = "value2"
}
Maps
- designed as a value
- strict syntax (mandatory commas, keys are strings)
- do not support @directives at their root
- can be piped
Example
map = {
"key": "value",
"key2": "value2"
}