Help with Mapping Nested JSON Objects in ListView

Database & APIs
Resolved

{
  "statusCode": 200,
  "message": "Orders fetched successfully",
  "result": [
    {
      "id": 1,
      "event": {
        "id": 75,
        "title": "test",
        "startDate": "2024-06-13T00:00:00.000Z"
      },
      "venue": {
        "id": 55,
        "name": "The Blue Note",
        "image": "https://baublejet.s3.ap-south-1.amazonaws.com/Venues/oceanview-bistro/01HYWEQDMBZ2PTY0HY1QB5ADY6.jpg",
        "address": "The Conference Center\n456 Elm Street,\nBirmingham, B1 1BB,\nUnited Kingdom"
      },
      "products": [
        {
          "id": 2,
          "name": "FitBand Pro",
          "image": "https://baublejet.s3.ap-south-1.amazonaws.com/products/smart-watch/01HZ1MT30Y8DRZ4TM00MW524T6.jpg",
          "quantity": 3
        },
        {
          "id": 4,
          "name": "VoiceMate Pro",
          "image": "https://baublejet.s3.ap-south-1.amazonaws.com/products/smart-speaker/01HZ1MZVF6SQ9KDHGXPKFQ531H.png",
          "quantity": 4
        }
      ],
      "totalAmount": "5119.45",
      "orderStatus": "Processing",
      "customerInvoiceUrl": "https://baublejet.s3.ap-south-1.amazonaws.com/invoice/customer/1717393849872-N/A-invoice.pdf"
    },
    {
      "id": 2,
      "event": null,
      "venue": {
        "id": 54,
        "name": "The Echo Arena",
        "image": "https://baublejet.s3.ap-south-1.amazonaws.com/Venues/venue-1/01HYWD437B1PMB94JJ7J289MQ3.jpg",
        "address": "The Grand Hall\n123 Main Street,\nSpringfield, IL 62701,\nUSA."
      },
      "products": [
        {
          "id": 1,
          "name": "UltraPhone X",
          "image": "https://baublejet.s3.ap-south-1.amazonaws.com/products/ultraphone-x/01HZRPMK73QYVSVJ2J14BFGP6N.jpg",
          "quantity": 1
        },
        {
          "id": 4,
          "name": "VoiceMate Pro",
          "image": "https://baublejet.s3.ap-south-1.amazonaws.com/products/smart-speaker/01HZ1MZVF6SQ9KDHGXPKFQ531H.png",
          "quantity": 1
        },
        {
          "id": 8,
          "name": "XtremePlay",
          "image": "https://baublejet.s3.ap-south-1.amazonaws.com/products/xtremeplay/01HZECYB2T6NX2K80BPQSJJF0K.jpg",
          "quantity": 2
        }
      ],
      "totalAmount": "1111",
      "orderStatus": "Processing",
      "customerInvoiceUrl": "https://baublejet.s3.ap-south-1.amazonaws.com/invoice/customer/1717393849872-N/A-invoice.pdf"
    }
  ]
}



Above is the structure of the JSON response:

What have you tried so far?

I'm working with an API that returns data structured as an array of objects, where each object contains a key whose value is another array of objects.I've been accessing this data using a manual JSON path, but this approach breaks when there is only one object in the array.

Did you check FlutterFlow's Documentation for this topic?
No
2
9 replies