Re:Portable Text – JSON rich text specification for content ...
by atombender on Thursday December 13, 2018 @03:15PM
(#18675626)
The _key is an ID, not a key as in "JSON key". It's metadata.
"style" is optional, so it doesn't make sense for "h1" to be a key.
More importantly, JSON is harder to work with when a key can be anything. A schema is more uniform and easy to make strict if all keys are reserved. This also makes it easier to map to data structures used in languages that have struct-type types. Think of the JSON objects here as structs, not key/value pairs:
type Block {
Style string
Children []Block
Type string
}
"style" is optional, so it doesn't make sense for "h1" to be a key.
More importantly, JSON is harder to work with when a key can be anything. A schema is more uniform and easy to make strict if all keys are reserved. This also makes it easier to map to data structures used in languages that have struct-type types. Think of the JSON objects here as structs, not key/value pairs:
or whatever.