Skip to content

Instantly share code, notes, and snippets.

@fehmicansaglam
Created May 8, 2012 14:12
Show Gist options
  • Save fehmicansaglam/2635412 to your computer and use it in GitHub Desktop.
Save fehmicansaglam/2635412 to your computer and use it in GitHub Desktop.
Pretty-Print JSON in Java
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonParser jp = new JsonParser();
JsonElement je = jp.parse(uglyJSONString);
String prettyJsonString = gson.toJson(je);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment