Reputation:
I am getting selected spinner value response like below -
{cCodeName=abc, nSerialNo=1}
How can i get "1" from "nSerialNo" in variable ?
Upvotes: 0
Views: 336
Reputation: 2127
you need to parse json like below:
String response={cCodeName=abc, nSerialNo=1};
JsonObject obj=new JsonObject(response);
String serialNo=obj.getString("nSerialNo");
in serialNo you get value of your spinner
Upvotes: 2
Reputation: 3486
try this
JSONObject resObject = new JSONObject(new String(yourResponseString));
int nSerialNo = resObject.getInt("nSerialNo");
This will get the nSerialNo
Value
Upvotes: 1