enter image description hereI have below JsonArry
[{"Tpid":"23, 45"}] and want to convert in stringList in below format list=[23, 45] Can anyone please help? Please note that it can contain 1k list also.
enter image description hereI have below JsonArry
[{"Tpid":"23, 45"}] and want to convert in stringList in below format list=[23, 45] Can anyone please help? Please note that it can contain 1k list also.
You JSonArray is [{"Tpid":"23, 45"}]
. What you want to extract is "23, 45"
.
Your array contains one JSON object. That JSON object is at index 0 of your array.
So, first, use your JSON library to retrieve your JSON object as the first element of your JSON array.
Then, get the value from your JSON object.
And finally, take the value and split it.
Example (pseudocode depending on your JSON library):
JSONObject jsonObject = jsonArray.get(0);
String value = jsonObject.getAsString("Tpid");
String[] arrayOfValues = value.split(", ");