3 ms·
You can represent annotations (which describe most of your examples) by adding keys: { "data": "some data", "data_comments": "here are my c
by nonchalance 13y ago
You can represent annotations (which describe most of your examples) by adding keys:
{
"data": "some data",
"data_comments": "here are my comments"
}
- dnautics 13y agoor just use the key "comment" more than once, which is sort of a hybrid of the ideas.
- IanCal 13y agoParsers might throw an error on duplicate keys, or launch emacs solving the towers of hanoi.
- sixbrx 13y agoNot transparent to actual clients of the data. edit for clarity: You're assuming that the application code isn't doing something with each key that it reflectively sees in the object, e.g. creating database fields to match them, or launching missiles towards those destinations, etc.. If you wouldn't automatically add dummy elements to a hashmap or dictionary in Java or Python, then you shouldn't add keys in a javascript object, unless you control the source to the program that will processing the data. Even then you shouldn't, because it will become a habit to add comments this way, and that will bite you when an extra key does matter.