3 ms·
As several people have pointed out, this doesn't make a lot of sense. People could just as well put parsing directives in special properties. On the other han
by dap 14y ago
As several people have pointed out, this doesn't make a lot of sense. People could just as well put parsing directives in special properties. On the other hand, having proper comments would make using JSON for configuration significantly nicer. It would also allow you to have JSON snippets that themselves are documented, as when documenting a JSON web API.
Using properties as comments is awkward at best: it doesn't match what people are used to, either the key or value ends up being a dummy, and consumers that iterate over properties have to be smart enough to ignore special doc properties (which can make automatic validation against a schema more difficult). The solution of running it through JSMin is pretty unsatisfying too. It's never wrong, so how about we always do that?