Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Created March 23, 2015 19:41
Show Gist options
  • Save jaytaph/08fcbc4551b80b4d190a to your computer and use it in GitHub Desktop.
Save jaytaph/08fcbc4551b80b4d190a to your computer and use it in GitHub Desktop.
JSON 1: {"foo":"bar","foo2":"bar2","foo3":"bar3"}
JSON 2: {"foo":"bar","foo2":"bar2","foo3":"bar3"}
JSON 3: { "foo": "bar", "foo2": "bar2", "foo3": "bar3" }
JSON 4: {"foo":"bar","foo2":"bar2","foo3":"bar3"}
JSON 4: {
"foo":"bar",
"foo2":"bar2",
"foo3":"bar3"
}
JSON 5: {
"foo": "bar",
"foo2": "bar2",
"foo3": "bar3"
}
import io;
import json;
// h = hash[[ "foo" : "bar" ]];
h = "{ \"foo\": \"bar\", \"foo2\": \"bar2\", \"foo3\": \"bar3\" }";
s = json.encode(h);
io.println("JSON 1: ", s);
io.println("JSON 2: ", json.encode(h));
io.println("JSON 3: ", json.encode(h, json.SPACED));
io.println("JSON 4: ", json.encode(h, json.PLAIN));
io.println("JSON 4: ", json.encode(h, json.PRETTY));
io.println("JSON 5: ", json.encode(h, json.PRETTY + json.SPACED));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment