The service returns json in the following format :
[
"ABC",
"HELLO",
"GOODBYE"
]
How can I count the number of strings inside the json?
The service returns json in the following format :
[
"ABC",
"HELLO",
"GOODBYE"
]
How can I count the number of strings inside the json?
You can use a Json parser like GSON, to deserialize the JSON.
// Deserialization
int[] ints2 = gson.fromJson("[1,2,3,4,5]", int[].class);
// ==> ints2 will be same as ints
System.out.println(int2.length);
see https://github.com/google/gson/blob/master/UserGuide.md#TOC-Array-Examples