Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Created August 3, 2016 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nacho4d/4aa6d73127135d0bd9503eea5546a535 to your computer and use it in GitHub Desktop.
Save nacho4d/4aa6d73127135d0bd9503eea5546a535 to your computer and use it in GitHub Desktop.
javax.json is too much hassle
JsonObject json = Json.createObjectBuilder()
.add("keyString", "string")
.add("keyBoolean", true)
.add("keyArraySimple", Json.createArrayBuilder()
.add(1)
.add(11)
.add(111).build())
.add("keyArrayObject", Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("lang", "ja")
.add("where", "どこ").build())
.add(Json.createObjectBuilder()
.add("lang", "es")
.add("where", "sourceforge").build()))
.add("keyObject", Json.createObjectBuilder()
.add("git", "svn")
.add("github", "sourceforge").build())
.addNull("keyNull").build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment