You can use this api https://code.google.com/p/google-gson/
It's simple and very useful,
Here's how to use the https://code.google.com/p/google-gson/ Api to resolve your problem
public class Test {
public static void main(String... strings) throws FileNotFoundException {
Reader reader = new FileReader(new File("<fullPath>/json.js"));
JsonElement elem = new JsonParser().parse(reader);
Gson gson = new GsonBuilder().create();
TestObject o = gson.fromJson(elem, TestObject.class);
System.out.println(o);
}
}
class TestObject{
public String fName;
public String lName;
public String toString() {
return fName +" "+lName;
}
}
json.js file content :
{"fName":"Mohamed",
"lName":"Ali"
}