Hi i am very much new to this json stuff,i have a requirement like reading json data from a text file.i could able to read only a single object but i want multiple objects to be read.please help me on this.
this is my json format in the text file
{
"_count": 30,
"_start": 0,
}{
"_count": 33,
"_start": 0,
}
this is what i have written in java
String s = null;
FileInputStream fis = new FileInputStream(new File("C:\\json.txt"));
s = IOUtils.toString(fis);
JSONObject json = (JSONObject)JSONSerializer.toJSON(s);
so with this code i could able to get the first object,is there anyway of getting the second one too..i am using json-lib-2.4-jdk15.jar to parse my json.
If you can change the way the text file stores the data, I recommend putting all the stuff into a JSON array; that way, each file will have only a single JSON object, meaning you could parse it purely with a JSON parser.