Can anyone help me in decoding this complex json?

{
"data": [
          {
            "order_id": 505597,
            "order_status": "pending",
            "order_status_name": "pending",
          },
          "billing": {
                "first_name": "test name",
                "last_name": "test",
                "phone": "123456",
                     },
        ],
    "success": true,
    "statusCode": 200,
}

let's assume i have my own model class (i know how to write this) and an API class (which i decode json in here), but i need to access the values of decoded json from a third class and idk how to do that :/ .

This is too important to me, thanks in advance for ur answers.


Solution 1: ManuH68

Here's a example:

void main() {
  var myJson = {
    "data": [
      {
        "order_id": 505597,
        "order_status": "pending",
        "order_status_name": "pending",
        "billing": [
          {
            "first_name": "test name",
            "last_name": "test",
            "phone": "123456",
          },
        ],
      },
      {
        "success": true,
        "statusCode": 200,
      }
    ]
  };

  print( (myJson["data"]![0]["billing"] as List)[0]["phone"]  );
}

There are also libraries like this one: https://pub.dev/packages/dart_json_mapper