Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1669)

Side by Side Diff: third_party/json_minify/README

Issue 9447090: Allow comments in extension config files. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed up license headers to pass license tests Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*! JSON.minify()
2 v0.1 (c) Kyle Simpson
3 MIT License
4 */
5
6 JSON.minify() minifies blocks of JSON-like content into valid JSON by removing a ll
7 whitespace *and* comments.
8
9 JSON parsers (like JavaScript's JSON.parse() parser) generally don't consider JS ON
10 with comments to be valid and parseable. So, the intended usage is to minify
11 development-friendly JSON (with comments) to valid JSON before parsing, such as:
12
13 JSON.parse(JSON.minify(str));
14
15 Now you can maintain development-friendly JSON documents, but minify them before
16 parsing or before transmitting them over-the-wire.
17
18 Though comments are not officially part of the JSON standard, this post from
19 Douglas Crockford back in late 2005 helps explain the motivation behind this pro ject.
20
21 http://tech.groups.yahoo.com/group/json/message/152
22
23 "A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore c omments."
24
25 Basically, comments are not in the JSON *generation* standard, but that doesn't mean
26 that a parser can't be taught to ignore them. Which is exactly what JSON.minify( )
27 is for.
28
29 The first implementation of JSON.minify() is in JavaScript, but the intent is to
30 port the implementation to as many other environments as possible/practical.
31
32 NOTE: As transmitting bloated (ie, with comments/whitespace) JSON would be waste ful
33 and silly, this JSON.minify() is intended for use in server-side processing
34 environments where you can strip comments/whitespace from JSON before parsing
35 a JSON document, or before transmitting such over-the-wire from server to browse r.
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/template/page_shell.html ('k') | third_party/json_minify/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698