java - Pass a String parameter as a non-array? -



java - Pass a String parameter as a non-array? -

i'm passing string parameter java function wrote.

when pass string parameter method accepting parameter follows http://mywebsite.com/getcity.php?stateid={"state":"alabama"}

i want method take string parameter follows http://mywebsite.com/getcity.php?stateid=alabama

how rid of {"state":"alabama"}?

hey guys,

i'm building android app. syntax below java. i'm going show i'm having trouble. i'm having problem on first line of method show entire method silly.

public jsonarray getdetails(string stateid) { // log.e showing {"state":"alabama"} // how show alabama? log.e("stateid= " + " = ", stateid); }

you've got json object there (and should url encoded if it's going live on url that).

treat json object , utilize jsonobject decode it. deal checked exception thrown see fit.

jsonobject jsonobject = new jsonobject(stateid); system.out.println(jsonobject.getstring("state"));

java

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -