dart JSON String convert to List String

后端 未结 3 434
南旧
南旧 2021-01-04 10:08

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         


        
3条回答
  •  無奈伤痛
    2021-01-04 10:21

    Try this one. Hope it helps.

    import 'dart:convert';
    
    void main() {
      String jsonResponse = '''
        ["006.01.01",
        "006.01.01 1090",
        "006.01.01 1090 1090.950",
        "006.01.01 1090 1090.950 052",
        "006.01.01 1090 1090.950 052 A",
        "006.01.01 1090 1090.950 052 A 521219",
        "006.01.01 1090 1090.950 052 A 521219",
        "006.01.01 1090 1090.950 052 A 521219",
        "006.01.01 1090 1090.950 052 A 521219",
        "006.01.01 1090 1090.950 052 A 521219",
        "006.01.01 1090 1090.950 052 B",
        "006.01.01 1090 1090.950 052 B 521211",
        "006.01.01 1090 1090.950 052 B 521211",
        "006.01.01 1090 1090.994",
        "006.01.01 1090 1090.994 001",
        "006.01.01 1090 1090.994 001 A",
        "006.01.01 1090 1090.994 001 A 511111",
        "006.01.01 1090 1090.994 001 A 511111",
        "006.01.01 1090 1090.994 001 A 511111",
        "006.01.01 1090 1090.994 001 A 511111"]
      ''';
    
      dynamic jsonParsed = json.decode(jsonResponse);
    
    //   print(jsonParsed);
    
      print(jsonParsed[5]);
    }
    

提交回复
热议问题