-1
I’m getting a comeback from a string
from the REST API as follows:
string bancos = ["BRADESCO", "ITAU", "SANTANDER"];
Only I want to make this string an array for me to iterate with the returns.
How do I turn this string into an array ?
-1
I’m getting a comeback from a string
from the REST API as follows:
string bancos = ["BRADESCO", "ITAU", "SANTANDER"];
Only I want to make this string an array for me to iterate with the returns.
How do I turn this string into an array ?
2
In the line below see how to do this using Gson:
String[] anotherStr = gson.fromJson("[\"abc\"]", String[].class);
In time, the above line was drawn from https://github.com/google/gson/blob/master/UserGuide.md#TOC-Primitives-Examples
In this case it is assumed that the received sequence is a valid serialization of a string array in Json.
Browser other questions tagged java array
You are not signed in. Login or sign up in order to post.
Could you show a copy of that part of json? .
– vladwoguer
@vladwoguer the return is a string exactly with this result
["BRADESCO", "ITAU", "SANTANDER"]
and I want to turn it into an array– Ikaro Sales
In case you have then the equivalent to do:
String bancos = "[\"BRADESCO\", \"ITAU\", \"SANTANDER\"]";
– vladwoguer
@vladwoguer No, for the second time as I said it is EXACTLY this
String bancos = "["BRADESCO", "ITAU", "SANTANDER"]"
– Ikaro Sales
Sorry I thought it was a Json.
– vladwoguer