JSONのコメント by Douglas Crockford

この記事はJavaScript界の権威Douglas CrockfordのGoogle+での投稿を翻訳したものです.

JSONのコメント (Comments in JSON)

私はJSONからコメントを抜きました. なぜなら,(??? I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability). 私はコメントがなくなることで一部の人を悲しませると思いましたが、 いれるべきではなかったのです.

あなたが設定ファイルにJSON形式を使っていて. コメントを付けたい場合はそのときはあなたのつけたいようにコメントを加えて下さい. JSONパーサーにデータを渡す前にJSMinを介してパイプを通せばいいのです.

JSMinって?

JSMinは, JavaScriptファイルからコメントや不要な空白・改行を取り除くツールです.

原文

I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.

Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.