-1

How can we parse such type of List data in Flutter? I tried different models but failed. Following is the data:

[
    {
        "course":"Computer Architecture Fall 2018 - KHI",
        "pending_assignment":[
            {
                "name":"OOAD Project Fall 2018 Section B & D",
                "dueDate":"Dec 14, 2018 10:00 pm"
            }
        ]
    },
    {
        "course":"Object Oriented Analysis and Design Fall 2018 - KHI",
        "pending_assignment":[
            {
                "name":"OOAD Project Fall 2018 Section B & D",
                "dueDate":"Dec 14, 2018 10:00 pm"
            }
        ]
    }
]
4
  • "I tried different models but failed" what have you tried? How did you fail? flutter.io/docs/development/data-and-backend/json Commented Jan 8, 2019 at 16:37
  • I tried the method defined there, but my data is in the form of list if you check it properly, and there is no such definition for that Commented Jan 8, 2019 at 16:57
  • You need to (de)serialize each entry myList.map((item) => deserializeJson(item)).toList() I made up deserializeJson. Replace it with the code that does the deserialization or parsing. Commented Jan 8, 2019 at 16:58
  • This question may probably have been answered here: stackoverflow.com/questions/51053954/… Commented Jan 20, 2020 at 9:39

1 Answer 1

-2

As you can check with this website (https://jsonformatter.org/json-parser), that JSON is not valid and contains errors.

For how to parse JSON in general, you can use the json.decode(jsonString); function from the dart:convert package. For more information on that you can check out this site: https://flutter.io/docs/development/data-and-backend/json

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.