maybe it just bothers me more since I work with designs of frameworks, system and data…
Having “meta-properties” like “mixintypes” in a regular data object is kinda awkward if it cannot be differentiated distinctly from the document itself. Currently, this is in the process that evaluates the json, which must check for the special “mixintypes” and process them separately.
What if there are more such “meta-properties” (or directives) required in the future?
May not be feasible, or practical, but the following is just a small suggestion:
prefix all meta-property with a special guard that marks them as such, so that they can never be confused with usual properties.
e.g.
// assume the following is body of some json object/node
{
"mixintypes" : "this is a REGULAR property",
"@mixintypes" : { "mixintypes" : "override" }, // this tells us that the child property "mixintypes" above should use override mode.
"@mixintype" : "merge" // alternative way to specify that THIS node should be merged, instead of being specified in the parent's "@mixintypes".
}
For a processor that does not recognize or need to process the meta-properties or directives, the properties starting with “@” will be stripped. i.e. the above json data is really:
{
"mixintypes" : "this is a REGULAR property"
}
EDIT: comments can be added into any json node as well using “@comment” property? even if it cannot be recognized by a processor, it will be recognized as that it should be excluded from the data.