Jump to content

Recommended Posts

Can someone please help me? i cant quite figure out how to parse out the following json data:

 

{"data":[{"id":2464,"vehiclemodel_id":969,"vehicleyear_id":39,"created_at":"2016-10-10 14:51:02","updated_at":"2016-10-10 14:51:02","attributevalues":{"data":[]},"items":{"data":[{"id":389,"brand_id":406,"country_id":227,"product_id":6,"sku":"015-01003","name":"MULTIRATE FORK SPRINGS 41MM","list_price":"126.95","standard_dealer_price":"88.99","supplier_product_id":"FS-1028","length":24.5,"width":4.7,"height":1.9,"weight":3.42,"upc":null,"superseded_sku":null,"status_id":"STK","status":"STK","unit_of_measurement_id":null,"has_map_policy":false,"sort":0,"created_at":"2016-06-17 20:47:51","updated_at":"2022-01-03 17:39:04","published_at":"2016-06-17 20:47:51","images":{"data":[{"id":94477,"domain":"cdn.wpsstatic.com\/","path":"images\/","filename":"88ff-5b02f15f8c0b7.jpg","alt":null,"mime":"image\/jpeg","width":5419,"height":3473,"size":6496067,"signature":"2f99154396b9412e1a0db1c10f29fdf1fc989f9db8236efdb28d52341a445405","created_at":"2018-05-21 16:18:46","updated_at":"2018-05-21 16:18:46"}]}},{"id":394,"brand_id":406,"country_id":227,"product_id":263235,"sku":"015-01012","name":"LOWERING FORK SPRINGS 41MM","list_price":"139.95","standard_dealer_price":"98.99","supplier_product_id":"LK-2011","length":24.5,"width":4.5,"height":1.7,"weight":3.43,"upc":null,"superseded_sku":null,"status_id":"STK","status":"STK","unit_of_measurement_id":null,"has_map_policy":false,"sort":0,"created_at":"2016-06-17 20:47:51","updated_at":"2022-01-03 17:39:05","published_at":"2016-06-17 20:47:51","images":{"data":[{"id":174,"domain":"cdn.wpsstatic.com\/","path":"images\/","filename":"becb-572a4ec444772.jpg","alt":null,"mime":"image\/jpeg","width":1000,"height":447,"size":138779,"signature":"dc570b1218a024f1acf9dd4b39fc6e7ea2a12d64fae46622e2a25d85e31d8d76","created_at":"2016-05-04 19:34:28","updated_at":"2017-02-23 18:01:01"}]}},{"id":634992,"brand_id":434,"country_id":227,"product_id":185661,"sku":"810-0607","name":"BRAKE PEDAL COVER TOURING BAD AXE BLACK","list_price":"99.00","standard_dealer_price":"69.30","supplier_product_id":"BAX-340-BLK","length":7,"width":5,"height":1,"weight":1,"upc":null,"superseded_sku":null,"status_id":"NEW","status":"NEW","unit_of_measurement_id":12,"has_map_policy":true,"sort":0,"created_at":"2022-04-13 07:53:11","updated_at":"2022-05-16 07:31:54","published_at":"2022-05-16 07:31:54","images":{"data":[]}}]},"vehiclemodel":{"data":{"id":969,"vehiclemake_id":22,"db2_key":"193","name":"FLSTF Softail Fat Boy","created_at":"2016-10-10 14:47:50","updated_at":"2018-04-11 17:43:23","vehiclemake":{"data":{"id":22,"db2_key":"HARLEY","name":"Harley-Davidson","created_at":"2016-10-10 14:47:14","updated_at":"2021-12-22 17:44:31"}}}},"vehicleyear":{"data":{"id":39,"name":1993,"created_at":"2016-10-10 14:50:07","updated_at":"2016-10-10 14:50:07"}}}],"meta":{"cursor":{"current":"61poYD9eaDkR","prev":null,"next":null,"count":1}}}

here is where it is also layed out differently:

{
  "data": [
    {
      "id": 2464,
      "vehiclemodel_id": 969,
      "vehicleyear_id": 39,
      "created_at": "2016-10-10 14:51:02",
      "updated_at": "2016-10-10 14:51:02",
      "attributevalues": {
        "data": []
      },
      "items": {
        "data": [
          {
            "id": 389,
            "brand_id": 406,
            "country_id": 227,
            "product_id": 6,
            "sku": "015-01003",
            "name": "MULTIRATE FORK SPRINGS 41MM",
            "list_price": "126.95",
            "standard_dealer_price": "88.99",
            "supplier_product_id": "FS-1028",
            "length": 24.5,
            "width": 4.7,
            "height": 1.9,
            "weight": 3.42,
            "upc": null,
            "superseded_sku": null,
            "status_id": "STK",
            "status": "STK",
            "unit_of_measurement_id": null,
            "has_map_policy": false,
            "sort": 0,
            "created_at": "2016-06-17 20:47:51",
            "updated_at": "2022-01-03 17:39:04",
            "published_at": "2016-06-17 20:47:51",
            "images": {
              "data": [
                {
                  "id": 94477,
                  "domain": "cdn.wpsstatic.com/",
                  "path": "images/",
                  "filename": "88ff-5b02f15f8c0b7.jpg",
                  "alt": null,
                  "mime": "image/jpeg",
                  "width": 5419,
                  "height": 3473,
                  "size": 6496067,
                  "signature": "2f99154396b9412e1a0db1c10f29fdf1fc989f9db8236efdb28d52341a445405",
                  "created_at": "2018-05-21 16:18:46",
                  "updated_at": "2018-05-21 16:18:46"
                }
              ]
            }
          },
          {
            "id": 394,
            "brand_id": 406,
            "country_id": 227,
            "product_id": 263235,
            "sku": "015-01012",
            "name": "LOWERING FORK SPRINGS 41MM",
            "list_price": "139.95",
            "standard_dealer_price": "98.99",
            "supplier_product_id": "LK-2011",
            "length": 24.5,
            "width": 4.5,
            "height": 1.7,
            "weight": 3.43,
            "upc": null,
            "superseded_sku": null,
            "status_id": "STK",
            "status": "STK",
            "unit_of_measurement_id": null,
            "has_map_policy": false,
            "sort": 0,
            "created_at": "2016-06-17 20:47:51",
            "updated_at": "2022-01-03 17:39:05",
            "published_at": "2016-06-17 20:47:51",
            "images": {
              "data": [
                {
                  "id": 174,
                  "domain": "cdn.wpsstatic.com/",
                  "path": "images/",
                  "filename": "becb-572a4ec444772.jpg",
                  "alt": null,
                  "mime": "image/jpeg",
                  "width": 1000,
                  "height": 447,
                  "size": 138779,
                  "signature": "dc570b1218a024f1acf9dd4b39fc6e7ea2a12d64fae46622e2a25d85e31d8d76",
                  "created_at": "2016-05-04 19:34:28",
                  "updated_at": "2017-02-23 18:01:01"
                }
              ]
            }
          },
          {
            "id": 634992,
            "brand_id": 434,
            "country_id": 227,
            "product_id": 185661,
            "sku": "810-0607",
            "name": "BRAKE PEDAL COVER TOURING BAD AXE BLACK",
            "list_price": "99.00",
            "standard_dealer_price": "69.30",
            "supplier_product_id": "BAX-340-BLK",
            "length": 7,
            "width": 5,
            "height": 1,
            "weight": 1,
            "upc": null,
            "superseded_sku": null,
            "status_id": "NEW",
            "status": "NEW",
            "unit_of_measurement_id": 12,
            "has_map_policy": true,
            "sort": 0,
            "created_at": "2022-04-13 07:53:11",
            "updated_at": "2022-05-16 07:31:54",
            "published_at": "2022-05-16 07:31:54",
            "images": {
              "data": []
            }
          }
        ]
      },
      "vehiclemodel": {
        "data": {
          "id": 969,
          "vehiclemake_id": 22,
          "db2_key": "193",
          "name": "FLSTF Softail Fat Boy",
          "created_at": "2016-10-10 14:47:50",
          "updated_at": "2018-04-11 17:43:23",
          "vehiclemake": {
            "data": {
              "id": 22,
              "db2_key": "HARLEY",
              "name": "Harley-Davidson",
              "created_at": "2016-10-10 14:47:14",
              "updated_at": "2021-12-22 17:44:31"
            }
          }
        }
      },
      "vehicleyear": {
        "data": {
          "id": 39,
          "name": 1993,
          "created_at": "2016-10-10 14:50:07",
          "updated_at": "2016-10-10 14:50:07"
        }
      }
    }
  ],
  "meta": {
    "cursor": {
      "current": "61poYD9eaDkR",
      "prev": null,
      "next": null,
      "count": 1
    }
  }
}

 

i can get the id 2464  but i cant get data under items -> data -> id (389) , or images data -> filename or list_price ect.. please help

Link to comment
https://forums.phpfreaks.com/topic/314812-json-parse-out-data-please-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.