android - how to separate the content of a string? -


json gives me value contains 3 values ​​within keep in separate

map gives me content, content has 3 values ​​should separated, language occupies?

 "mapa":[     "a:3:{s:7:\"address\";s:54:\"volc\u00e1n parinacota 1202-1220, chill\u00e1n, biob\u00edo, chile\";      s:3:\"lat\";s:19:\"-36.620445433045944\";      s:3:\"lng\";s:18:\"-72.07966608584445\";          }"         ] 

in json string , there 2 symbols guide through parsing :

{ - indicates jsonobject

[ - indicates jsonarray

when parsing json string, should go through items iteratively. understand how many jsonobjects , jsonarrays have in string , , should start parsing, use json-visualizer tool this website. :
enter image description here

example : see, root object jsonobject consists of jsonarray 3 jsononjects. parse such structure can use :

jsonobject jsonobj = new jsonobject(jsonstring);  string result = jsonobject.getstring("success"); string error_number = jsonobject.getstring("error_number");     string error_message = jsonobject.getstring("error_message");   json array jsonarray = jsonobj.getjsonarray();  string[] names = new string[jsonarray.length()];     string[] formattednames = new string[jsonarray.length()];    for(int i=0;i<jsonarray.length();i++) {     jsonobject jsonobject = jsonarray.getjsonobject(i);      names [i] = jsonobject.getstring("name");     formattednames [i] = jsonobject.getstring("formattedname");   } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -