Avatar of tjyoung
tjyoung
 asked on

Getting @attribute in my returned json and can't figure out how to access values

HI,
I'm using curl to access a webservice for vin decoding vehicles. I'm getting a response but it has a few twists I haven't come across and having difficulty accessing the values.

the response looks like this: (its huge but didn't want to miss something that may be important).

{ "@attributes" : { "bestMakeName" : "Mazda",
      "bestModelName" : "Mazda3",
      "bestStyleName" : "4dr Sdn GX",
      "bestTrimName" : "GX",
      "country" : "CA",
      "language" : "en",
      "modelYear" : "2012"
    },
  "basePrice" : { "@attributes" : { "unknown" : "false" },
      "destination" : { "@attributes" : { "high" : "1695.0",
              "low" : "1695.0"
            } },
      "invoice" : { "@attributes" : { "high" : "0.0",
              "low" : "0.0"
            } },
      "msrp" : { "@attributes" : { "high" : "17095.0",
              "low" : "15895.0"
            } }
    },
  "engine" : { "@attributes" : { "highOutput" : "false" },
      "cylinders" : "4",
      "displacement" : { "@attributes" : { "cubicIn" : "122",
              "liters" : "2.0"
            } },
      "engineType" : "4 Cylinder Engine",
      "fuelCapacity" : { "@attributes" : { "high" : "55.0",
              "low" : "55.0",
              "unit" : "L"
            } },
      "fuelEconomy" : { "@attributes" : { "unit" : "L/100 km" },
          "city" : { "@attributes" : { "high" : "8.7",
                  "low" : "8.1"
                } },
          "hwy" : { "@attributes" : { "high" : "6.0",
                  "low" : "5.9"
                } }
        },
      "fuelType" : "Gasoline Fuel",
      "horsepower" : { "@attributes" : { "rpm" : "6500",
              "value" : "148.0"
            } },
      "installed" : { "@attributes" : { "cause" : "VIN" } },
      "netTorque" : { "@attributes" : { "rpm" : "4500",
              "value" : "135.0"
            } }
    },
  "genericEquipment" : [ { "categoryId" : "1001",
        "installed" : { "@attributes" : { "cause" : "VIN" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1002",
        "installed" : { "@attributes" : { "cause" : "VIN" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1005",
        "installed" : { "@attributes" : { "cause" : "VIN" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1007",
        "installed" : { "@attributes" : { "cause" : "VIN" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1008",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1014",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1017",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1018",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1020",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1034",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1039",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1042",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1048",
        "installed" : { "@attributes" : { "cause" : "Engine" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1055",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1059",
        "installed" : { "@attributes" : { "cause" : "Engine" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1062",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1063",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1065",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1076",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1077",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1082",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1084",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1087",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1092",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1097",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1098",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1100",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1126",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1127",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1150",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1159",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1164",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1166",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1175",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1176",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1187",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1197",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1198",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1227",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1230",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1304",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "categoryId" : "1310",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      }
    ],
  "responseStatus" : { "@attributes" : { "description" : "Successful",
          "responseCode" : "Successful"
        } },
  "standard" : [ { "category" : [ { "@attributes" : { "id" : "1048" } },
            { "@attributes" : { "id" : "1059" } }
          ],
        "description" : "2.0L DOHC 16-valve I4 engine",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "Engine" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1042" } },
        "description" : "Front wheel drive",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Front independent strut suspension w/coil springs",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Rear independent multi-link suspension w/coil springs",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Front/rear stabilizer bars",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1084" } },
        "description" : "Pwr rack & pinion steering",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1020" } },
        "description" : "Front ventilated/rear solid pwr disc brakes",
        "header" : "MECHANICAL",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1092" } },
            { "@attributes" : { "id" : "1097" } }
          ],
        "description" : "P205/55R16 all-season tires",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1098" } },
        "description" : "Temporary spare tire",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Black grille w/black grille bar",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Halogen headlamps",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1065" } },
        "description" : "Body-colour pwr mirrors",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1127" } },
            { "@attributes" : { "id" : "1159" } }
          ],
        "description" : "Variable intermittent windshield wipers",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Body-colour door handles",
        "header" : "EXTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1014" } },
            { "@attributes" : { "id" : "1017" } },
            { "@attributes" : { "id" : "1150" } }
          ],
        "description" : "AM/FM stereo w/CD/MP3 player -inc: (4) speakers",
        "header" : "ENTERTAINMENT",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1230" } },
        "description" : "Aux input jack",
        "header" : "ENTERTAINMENT",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1082" } },
        "description" : "Front bucket seats w/active headrests",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1076" } },
            { "@attributes" : { "id" : "1304" } }
          ],
        "description" : "60/40 split-folding rear seats w/adjustable headrests -inc: lock function",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Centre console w/lid",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Rear centre armrest w/(2) cupholders",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1055" } },
        "description" : "Custom fitted front/rear floor mats",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Driver foot rest",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1087" } },
        "description" : "Tilt/telescopic steering wheel",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Warning lights -inc: oil pressure, check engine, low washer fluid, low fuel level, door ajar, air bags",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Exterior temperature gauge",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1126" } },
        "description" : "Pwr windows w/driver 1-touch down feature & driver side illuminated switch",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1166" } },
        "description" : "Engine immobilizer theft deterrent system",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Rear heater ducts",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1034" } },
        "description" : "Rear window defroster",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Illuminated glove compartment",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Dual front cupholders",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1164" } },
        "description" : "(2) 12V pwr outlets",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Moulded cloth door trim",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Illuminated entry",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Front door storage pockets w/bottle holders",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Rear door bottle holders",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Day/night rearview mirror",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1175" } },
            { "@attributes" : { "id" : "1176" } }
          ],
        "description" : "Driver/passenger sunvisors w/vanity mirrors",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "(3) passenger assist handles",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1187" } },
        "description" : "Map lights",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Trunk/cargo light",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Ignition key illumination",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Passenger side seatback pocket",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "(2) coat hooks",
        "header" : "INTERIOR",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1018" } },
        "description" : "Anti-lock brake system -inc: electronic brake-force distribution",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Side-impact door beams",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1001" } },
            { "@attributes" : { "id" : "1002" } },
            { "@attributes" : { "id" : "1310" } }
          ],
        "description" : "Driver & front passenger air bags w/passenger sensor",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1005" } },
        "description" : "Front side-impact air bags",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : [ { "@attributes" : { "id" : "1007" } },
            { "@attributes" : { "id" : "1008" } }
          ],
        "description" : "Front/rear side curtain air bags",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Height-adjustable front seat belts w/pretensioners, force limiters",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "All seating position 3-point seat belts",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1197" } },
        "description" : "Internal trunk release",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "category" : { "@attributes" : { "id" : "1039" } },
        "description" : "Child safety rear door locks",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      },
      { "description" : "Integrated child seat anchor brackets",
        "header" : "SAFETY",
        "installed" : { "@attributes" : { "cause" : "BaseEquipment" } },
        "styleId" : [ "337292",
            "337293"
          ]
      }
    ],
  "style" : [ { "@attributes" : { "altBodyType" : "4dr Car",
            "drivetrain" : "Front Wheel Drive",
            "fleetOnly" : "false",
            "id" : "337292",
            "mfrModelCode" : "D4XS52",
            "modelFleet" : "false",
            "modelYear" : "2012",
            "name" : "4dr Sdn Man GX",
            "nameWoTrim" : "4dr Sdn Man",
            "passDoors" : "4",
            "trim" : "GX"
          },
        "basePrice" : { "@attributes" : { "destination" : "1695.0",
                "invoice" : "0.0",
                "msrp" : "15895.0",
                "unknown" : "false"
              } },
        "bodyType" : "4dr Car",
        "division" : "Mazda",
        "marketClass" : "4-door Compact Passenger Car",
        "model" : "Mazda3",
        "stockImage" : { "@attributes" : { "filename" : "14383.jpg",
                "height" : "200",
                "url" : "http://media.carbook.com/autoBuilderData/stockPhotos/14383.jpg",
                "width" : "400"
              } },
        "subdivision" : "Mazda Cars"
      },
      { "@attributes" : { "altBodyType" : "4dr Car",
            "drivetrain" : "Front Wheel Drive",
            "fleetOnly" : "false",
            "id" : "337293",
            "mfrModelCode" : "D4XS82",
            "modelFleet" : "false",
            "modelYear" : "2012",
            "name" : "4dr Sdn Auto GX",
            "nameWoTrim" : "4dr Sdn Auto",
            "passDoors" : "4",
            "trim" : "GX"
          },
        "basePrice" : { "@attributes" : { "destination" : "1695.0",
                "invoice" : "0.0",
                "msrp" : "17095.0",
                "unknown" : "false"
              } },
        "bodyType" : "4dr Car",
        "division" : "Mazda",
        "marketClass" : "4-door Compact Passenger Car",
        "model" : "Mazda3",
        "stockImage" : { "@attributes" : { "filename" : "14383.jpg",
                "height" : "200",
                "url" : "http://media.carbook.com/autoBuilderData/stockPhotos/14383.jpg",
                "width" : "400"
              } },
        "subdivision" : "Mazda Cars"
      }
    ],
  "technicalSpecification" : [ { "range" : { "@attributes" : { "max" : "2937.0",
                "min" : "2875.0"
              } },
        "titleId" : "10",
        "value" : [ { "@attributes" : { "condition" : "",
                  "value" : "2875"
                },
              "styleId" : "337292"
            },
            { "@attributes" : { "condition" : "",
                  "value" : "2937"
                },
              "styleId" : "337293"
            }
          ]
      },
      { "range" : { "@attributes" : { "max" : "180.9",
                "min" : "180.9"
              } },
        "titleId" : "304",
        "value" : { "@attributes" : { "condition" : "",
                "value" : "180.9"
              },
            "styleId" : [ "337292",
                "337293"
              ]
          }
      },
      { "range" : { "@attributes" : { "max" : "69.1",
                "min" : "69.1"
              } },
        "titleId" : "305",
        "value" : { "@attributes" : { "condition" : "",
                "value" : "69.1"
              },
            "styleId" : [ "337292",
                "337293"
              ]
          }
      },
      { "range" : { "@attributes" : { "max" : "57.9",
                "min" : "57.9"
              } },
        "titleId" : "306",
        "value" : { "@attributes" : { "condition" : "",
                "value" : "57.9"
              },
            "styleId" : [ "337292",
                "337293"
              ]
          }
      }
    ],
  "vinDescription" : { "@attributes" : { "bodyType" : "Sedan",
          "division" : "Mazda",
          "drivingWheels" : "Front",
          "modelName" : "Mazda3",
          "modelYear" : "2012",
          "styleName" : "4dr Sdn GX",
          "vin" : "JM1BL1UF3C1627780"
        },
      "WorldManufacturerIdentifier" : "Japan Mazda Passenger Car ",
      "marketClass" : "4-door Compact Passenger Car",
      "restraintTypes" : [ { "category" : "Driver Air Bag",
            "group" : "Safety",
            "header" : "Air Bag - Frontal"
          },
          { "category" : "Passenger Air Bag",
            "group" : "Safety",
            "header" : "Air Bag - Frontal"
          },
          { "category" : "Front Side Air Bag",
            "group" : "Safety",
            "header" : "Air Bag - Side"
          },
          { "category" : "Front Head Air Bag",
            "group" : "Safety",
            "header" : "Air Bag - Side"
          }
        ]
    }
}

Open in new window

I'm trying to access the values for vinDescription (modelYear, modelName as an example).

With those values I'm populating a few input fields using jquery. That works fine if I had the correct way of referencing the values. I'm using for partial example:

function(data){
      $('input[name="year"]').val(data.vinDescription.modelYear);
      },
    'json');

the data.vinDescription.modelYear isn't getting the correct value/failing.

Here is a portion of the curl request that is getting the above response if that helps at all:

$vehicle = simplexml_load_string($result);
                    // Output result
            header('Cache-Control: no-cache, must-revalidate');
            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
            header('Content-type: application/json');
            echo json_encode($vehicle);
PHPJavaScript

Avatar of undefined
Last Comment
tjyoung

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gr8gonzo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
tjyoung

ASKER
awesome thanks. I tried a multitude of ways but couldn't figure out how to handle the attribute.
tjyoung

ASKER
Sorry, must have been cached. Seems to be working now.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck