-2

From the server I get a string with exactly the following format:

[{"valueOne", "341", "valueTwo": "1432"}, {"valueOne", "6483", "valueTwo": "3267"}]

I understand that it is two JSONObject into an array, but .. Howparse this?

My intention is to have all the concatenated string values, like this:

Strings values = (341 + 1432 + 6483 + 3267);

I guess I must first convert the string that I have received from the server to JSONObject, but do not know how to continue.

In this example there are two JSONObjects, but sometimes may contain three or more.

Many times I get values from JSONObjects values, but I have never seen in this case. I searched for information but can not find a solution that is useful to me.

I appreciate the help

greetings!

Sergio76
  • 3,835
  • 16
  • 61
  • 88

1 Answers1

0
JsonArray jArray= <your parsed array>;

for(int i=0;i<=jArray.lenght()-1;i++)
{
  String valueOne=jArray.getJsonObject(i).getString("ValueOne");
  String valueTwo=jArray.getJsonObject(i).getString("ValueTwo");
}

you can do whatever you want with the values.

Durga Mohan
  • 1,110
  • 9
  • 11