Hi so I have encoded JSON from PHP and it comes out like this :
{"ticket":[
{"ticket":[{"a":"10.00","b":"1.00","c":"1.00","d":"abcde","f":"7"},
{"ticket":[{"a":"10.00","b":"1.00","c":"1.00","d":"abcde","f":"7"}
]}
object {1}
ticket [2]
0 {6}
a : 10.00
b : 1.00
c : 1.00
d : abcde
e : 7
1 {6}
a : 10.00
b : 1.00
c : 1.00
d : abcde
e : 7
when i open this in java the whole thing comes across as one JSONObject
which I break into two JSONArray
s the first contains the work ticket
and then second contains
{"ticket":[{"a":"10.00","b":"1.00","c":"1.00","d":"abcde","f":"7"},
{"ticket":[{"a":"10.00","b":"1.00","c":"1.00","d":"abcde","f":"7"}
The second JSONArray
as you expect has a length of 2 and can be broken down into the two lines above (each as a string) but is there a way i can get the data out of the string without doing stuff on it /tokenising it looking for the values of a
,b
,c
...etc ?
Try GSON library which can convert a JSON string to an equivalent Java object.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments