This question already has an answer here:
I need to be able to read a JSON string from a file and parse it.
I want to know if the string is a "well formed" JSON. If so, I need to be able to read all the name value pairs.
Is there a JSON library that comes bundled with Java itself?
I would prefer something that comes with the standard Java distribution instead of downloading another external library.
I am using JDK 1.6.
There is the javax.script Api which is built in to 1.6 http://docs.oracle.com/javase/6/docs/api/javax/script/package-summary.html
Try it approach without using external library
http://blog.julienviet.com/2011/12/26/json-to-java-with-jdk6/
EDITED
GitHub is more reliable source of the code from specified link. https://gist.github.com/vietj/1521692
The key is to use javascript to parse, it can be invoked with:
Javascript part, json2java.js: