Permalink
Browse files

adding another test

  • Loading branch information...
1 parent 1b3ec8a commit 33c4a3cb82890e3b1a2c5551b58a63ced6237d1a @getify committed Jun 26, 2010
Showing with 33 additions and 10 deletions.
  1. +33 −10 test.minify.html
View
@@ -14,17 +14,40 @@
<p>test #1</p>
<textarea id="orig_json1" cols="50" rows="12">
+// this is a JSON file with comments
+{
+ "foo": "bar", // this is cool
+ "bar": [
+ "baz", "bum", "zam"
+ ],
+/* the rest of this document is just fluff
+ in case you are interested. */
+ "something": 10,
+ "else": 20
+}
-{"/*":"*/","//":"",/*"//"*/"/*/"://
-"//"}
-
+/* NOTE: You can easily strip the whitespace and comments
+ from such a file with the JSON.minify() project hosted
+ here on github at http://github.com/getify/JSON.minify
+*/
</textarea>
<p>result #1</p>
<textarea id="new_json1" cols="50" rows="12"></textarea>
<p>test #2</p>
<textarea id="orig_json2" cols="50" rows="12">
+
+{"/*":"*/","//":"",/*"//"*/"/*/"://
+"//"}
+
+</textarea>
+<p>result #2</p>
+<textarea id="new_json2" cols="50" rows="12"></textarea>
+
+
+<p>test #3</p>
+<textarea id="orig_json3" cols="50" rows="12">
/*
this is a
multi line comment */{
@@ -37,25 +60,25 @@
}
</textarea>
-<p>result #2</p>
-<textarea id="new_json2" cols="50" rows="12"></textarea>
+<p>result #3</p>
+<textarea id="new_json3" cols="50" rows="12"></textarea>
-<p>test #3</p>
-<textarea id="orig_json3" cols="50" rows="12">
+<p>test #4</p>
+<textarea id="orig_json4" cols="50" rows="12">
{"foo": "ba\"r//", "bar\\": "b\\\"a/*z",
"baz\\\\": /* yay */ "fo\\\\\"*/o"
}
</textarea>
-<p>result #3</p>
-<textarea id="new_json3" cols="50" rows="12"></textarea>
+<p>result #4</p>
+<textarea id="new_json4" cols="50" rows="12"></textarea>
<script type="text/javascript">
var old;
-for (var i=1; i<=3; i++) {
+for (var i=1; i<=4; i++) {
old = document.getElementById("orig_json"+i).value;
document.getElementById("new_json"+i).value = JSON.minify(old);
}

0 comments on commit 33c4a3c

Please sign in to comment.