Skip to content

Instantly share code, notes, and snippets.

@azakordonets
Created May 6, 2014 14:33
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 azakordonets/48b4f885ae18112d885e to your computer and use it in GitHub Desktop.
Save azakordonets/48b4f885ae18112d885e to your computer and use it in GitHub Desktop.
This method allows you to read from file (where already stored data in json format) and save it into JSON object.
public static JSONObject getJSONFromFile(String path) throws JSONException, IOException, ParseException {
JSONParser parser = new JSONParser();
Object obj = parser.parse(new FileReader(path));
return new JSONObject(obj.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment