I need to read JsonElements
from given JSON
files. I am using org.json.simple
jar.
Here is the sample of my json:
[{
"Submission ID": "9938306",
"Lat": "17.447191666666665",
"Long": "78.38849"
},
{
"Submission ID": "9938306",
"Lat": "17.447191666666665",
"Long": "78.38849"
}]
I wrote this following code to read JsonArray
but not able to figure out how to read JsonElements
from it:
try {
JSONParser parser = new JSONParser();
Object obj = parser.parse(new FileReader("sampleData.json"));
JSONArray array = (JSONArray) obj;
Iterator iter = array.iterator();
while (iter.hasNext()){
}
}
How can I read all JSONelements
for each JSONarray
? For example:
EDIT
I want to iterate all JsonElements
in JsonAray
. In my given Json I do have submission ID
and submission_ID
. Key is dynamic in some point and I need to read it and want to apply some regex
on it.