I know this isn't a FreeBSD specific question but I'm hoping to get some help from others who may have ran into the same problem. I'm writing a Java application that gets some JSON data that I need to parse and I'm having a difficult time with it, I'm hoping someone here could shed some light.
The problem I'm having is I never know what the JSON data will look like beforehand. I need to get the JSON structure dynamically. Take the following pseudo-JSON as an example:
I found a library called JSON-Path that will allow me to call values from the above object similar to x-path with XML. The problem: I need to know the structure of the above object to be able to use JSON-Path.
Ideally I'd like to have it broken down in an ArrayList. Maybe using RegEx? Any insight to this problem would be helpful.
Thank you!
Edit:
Sorry if I'm not using the right JSON terms I've not worked with it much in the past, and I can't stand this format.
The problem I'm having is I never know what the JSON data will look like beforehand. I need to get the JSON structure dynamically. Take the following pseudo-JSON as an example:
Code:
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
I found a library called JSON-Path that will allow me to call values from the above object similar to x-path with XML. The problem: I need to know the structure of the above object to be able to use JSON-Path.
Ideally I'd like to have it broken down in an ArrayList. Maybe using RegEx? Any insight to this problem would be helpful.
Thank you!
Edit:
Sorry if I'm not using the right JSON terms I've not worked with it much in the past, and I can't stand this format.