(Solved) Parsing nested JSON - issue with string values
Hi!
Just started with B4A yesterday and ran into a problem.
If JSON data is parsed in several passes, string values throw an exception at second pass, if they are empty or contain spaces (or brackets etc).
The reason for it is simple - first parsing removes all double quotes (") from the string, making it invalid for next pass.
The question - is this supposed to be like that or am I doing it wrong?
Code goes pretty much like this:
Now, this is by no means a showstopper and I can work around it. It just would be nice if I didn't have to.
Hi!
Just started with B4A yesterday and ran into a problem.
If JSON data is parsed in several passes, string values throw an exception at second pass, if they are empty or contain spaces (or brackets etc).
The reason for it is simple - first parsing removes all double quotes (") from the string, making it invalid for next pass.
The question - is this supposed to be like that or am I doing it wrong?
Code goes pretty much like this:
B4X:
Dim s As string
Dim the_map as map
Dim the_list as list
Dim JSON1 as JSONParser
Dim JSON2 as JSONParser
s = "JSON data"
JSON1.initialize (s)
the_map = JSON1.nextobject
s = the_map.get("Keyword")
JSON2.initialize (s)
the_list = JSON2.nextarray
Now, this is by no means a showstopper and I can work around it. It just would be nice if I didn't have to.
Last edited: