Skip to content
Advertisement

What’s the best way to load a JSONObject from a json text file?

What would be the easiest way to load a file containing JSON into a JSONObject.

At the moment I am using json-lib.

This is what I have, but it throws an exception:

JavaScript

The output is:

JavaScript

Advertisement

Answer

try this:

JavaScript

and this is your sample-json.txt , should be in json format

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement