Re:Comments in JSON
by IanCal on Friday August 02, 2013 @02:03PM
(#6148576)
XML PIs have a spec, don't they? (actual question) From some googling the W3C site has this :
> PIs are not part of the document's character data, but must be passed through to the application
If they're being passed through and not being used by the parser, it's no different really than a
"directive" : "blah"
in JSON, which is fine. The application at the end needs to deal with it, but the parser doesn't, and that's really important. If it's just a comment, passing the file into and out of a program could remove the comment.
If the parser does need to understand the directive, at least there's a difference between an error of "I don't understand directive X" and no error at all because your parser ignored the comments.
> PIs are not part of the document's character data, but must be passed through to the application
If they're being passed through and not being used by the parser, it's no different really than a
in JSON, which is fine. The application at the end needs to deal with it, but the parser doesn't, and that's really important. If it's just a comment, passing the file into and out of a program could remove the comment. Should be the same as If the parser does need to understand the directive, at least there's a difference between an error of "I don't understand directive X" and no error at all because your parser ignored the comments.