0

I am getting selected spinner value response like below -

{cCodeName=abc, nSerialNo=1}

How can i get "1" from "nSerialNo" in variable ?

2 Answers2

2

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

Vishal Thakkar
  • 2,107
  • 2
  • 14
  • 31
1

try this

  JSONObject resObject = new JSONObject(new String(yourResponseString));
  int nSerialNo = resObject.getInt("nSerialNo");

This will get the nSerialNo Value

Sanoop Surendran
  • 3,361
  • 4
  • 26
  • 49