I have an API that calls the json String array as follows:
[
\"006.01.01\",
\"006.01.01 1090\",
\"006.01.01 1090 1090.950\",
\"006.01.01 1090 1090.95
The result of parsing a JSON list is a List
. The return type of jsonDecode
is just dynamic
.
You can cast such a list to a List
as
List stringList = (jsonDecode(input) as List).cast();
You can also just use it as a List
and then assign each value to String
:
List rellyAStringList = jsonDecode(input);
for (String string in reallyAStringList) { ... }
The effect is approximately the same - each element is checked for being a string when it is taken out of the list.