+ Start a Discussion
Carter85Carter85 

Need help parsing a Map created by deserialized JSON

I'm working on trying to integrate functionality with the Edmunds API and I'm having trouble getting the exact values I want from the JSON response.  My code so far is this:
public with sharing class CM_VINDecode {

	private static final String URLprefix = 'https://api.edmunds.com/api/vehicle/v2/vins/';
	private static final String URLend = '?fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';    
	
	private static final String ULRStylePrefix = 'https://api.edmunds.com/api/vehicle/v2/styles/';
	private static final String URLStyleEnd = '/equipment?availability=standard&equipmentType=OTHER&fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';
	
	public string url	{get;set;}
	public string url2	{get;set;}
	public string vin	{get;set;}
	public string trim	{get;set;}
	public string styleID	{get;set;}
	public List<String> features	{get;set;}
	
	private static final String ELEMENT_MAKE = 'name';
    private static final String ELEMENT_MODEL = 'model';
    	
  	public void setVin(){
  		features = new list<String>();
  		url = URLprefix + vin + URLend;
  		getCalloutResponseContents(url);
  		}
  
  
  	// Pass in the endpoint to be used using the string url
	public String getCalloutResponseContents(String url) {
		// Instantiate a new HTTP request
    	Http h = new Http();
    	HttpRequest req = new HttpRequest();
    	req.setEndpoint(url);
    	req.setMethod('GET');

    	// Send the request, and parse response
    	HttpResponse res = h.send(req);
    	system.debug('Response: ' + res.getBody());
    	
		JSONParser parser = JSON.createParser(res.getBody());
    	
    	while (parser.nextToken() != null) {
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'trim')) {
                // Get the value.
                parser.nextToken();
                trim = parser.getText();
            	system.debug('Trim: ' + trim);
            	}
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'styles')) {
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	styleID = parser.getText();
                system.debug('StyleID: ' + styleID);
                }    
                }
        
        url2 = ULRStylePrefix + styleID + URLStyleEnd;
        	
        getStyle(url2);
		return null;
		}
		
	public String getStyle(String url2) {
		// Instantiate request
    	Http h = new Http();
    	HttpRequest req2 = new HttpRequest();
    	req2.setEndpoint(url2);
    	req2.setMethod('GET');
		
		// Send the request, and parse response
    	HttpResponse res2 = h.send(req2);
    	system.debug('Response: ' + res2.getBody());
    	
    	string jsonString = res2.getBody();
    	
    	Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(jsonString);
    	List<Object> e = (List<Object>)m.get('equipment');
    	
    	system.debug('Equipment: ' + e);
    	set<string> clr = new set<string>();
    	for(integer i = 0; i < m.size(); i++){
    	Map<String,Object> m2 = (Map<String,Object>)e[i];
    	    system.debug('M2' + m2);
    	    for(Object c : m2.values()){
    			string b =  string.valueOf(m2.get('name'));
    			features.add(b);
    			}
    		}
    		clr.addAll(features);
    		features.clear();
    		features.addAll(clr);
    	
    	   system.debug('Features: ' + features); 	
    	return null;
		}
		
	public class Equipment {
		public String id;
		public String name;
		public String equipmentType;
		public String availability;
		public List<Attributes> attributes;
		}

	public List<Equipment> equipment;
	public Integer equipmentCount;

	public class Attributes {
		public String name;
		public String value;
	}
	
	public static CM_VINDecode parse(String json) {
		system.debug('Result: ' + (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class));
		return (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class);
	}	
	
}
And this is the response JSON I've been working with:
{"equipment":[{"id":"20072640525","name":"Cargo Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cargo Capacity, All Seats In Place","value":"34.1"},{"name":"Cargo Capacity, Rear Seat Down Or Removed","value":"65.4"},{"name":"Max Cargo Capacity","value":"65.4"}]},{"id":"20072640526","name":"Mobile Connectivity","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Satellite Communications","value":"MAZDA CONNECT"},{"name":"Bluetooth","value":"Bluetooth"}]},{"id":"20072640528","name":"Instrumentation","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"External Temperature Gauge","value":"external temperature display"},{"name":"Tire Pressure Monitoring System","value":"tire pressure monitoring"},{"name":"Tachometer","value":"tachometer"},{"name":"Trip Computer","value":"trip computer"},{"name":"Clock","value":"clock"}]},{"id":"20072640529","name":"Misc. Exterior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Spoiler","value":"rear spoiler"},{"name":"Exterior Camera","value":"rear view camera"}]},{"id":"20072640530","name":"Doors","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Liftgate Window","value":"fixed"},{"name":"Rear Door Type","value":"liftgate"},{"name":"Number Of Doors","value":"4"}]},{"id":"20072640531","name":"Exterior Lights","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Fog Lights","value":"front fog/driving lights"},{"name":"Headlights Auto Delay","value":"auto delay off"},{"name":"Daytime Running Lights","value":"daytime running lights"},{"name":"Headlights Dusk Sensor","value":"dusk sensing"}]},{"id":"20072640534","name":"Front Passenger Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Passenger Seat","value":"height adjustable"},{"name":"Number Of Passenger Seat Manual Adjustments","value":"6"},{"name":"Heated Passenger Seat","value":"multi-level heating"}]},{"id":"20072640536","name":"Steering","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Steering","value":"electric power steering"}]},{"id":"20072640537","name":"1st Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seat Type","value":"bucket"},{"name":"Adjustable Seat Headrest","value":"height adjustable headrests"},{"name":"1st Row Upholstery","value":"leather"},{"name":"Number Of 1st Row Headrests","value":"2"},{"name":"Seat Whiplash Protection","value":"whiplash protection system"}]},{"id":"20072640538","name":"Interior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Leg Room","value":"39.3"},{"name":"1st Row Hip Room","value":"55.2"},{"name":"2nd Row Shoulder Room","value":"55.5"},{"name":"1st Row Head Room","value":"39.0"},{"name":"1st Row Leg Room","value":"41.0"},{"name":"2nd Row Head Room","value":"39.0"},{"name":"2nd Row Hip Room","value":"53.7"},{"name":"Epa Interior Volume","value":"136.4"},{"name":"1st Row Shoulder Room","value":"57.5"}]},{"id":"20072640539","name":"Spare Tire/Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Spare Tire Mount Location","value":"inside"},{"name":"Spare Tire Size","value":"temporary"}]},{"id":"20072640541","name":"Power Outlets","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Outlet(s)","value":"12V"}]},{"id":"20072640543","name":"Exterior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Overall Width Without Mirrors","value":"72.4"},{"name":"Wheelbase","value":"106.3"},{"name":"Minimum Ground Clearance","value":"8.5"},{"name":"Overall Length","value":"179.3"},{"name":"Overall Height","value":"67.3"}]},{"id":"20072640544","name":"Windows","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Privacy Glass","value":"privacy glass"},{"name":"Rain Sensing Front Wipers","value":"rain sensing"},{"name":"One Touch Windows","value":"1"},{"name":"Power Windows","value":"power windows"},{"name":"Rear Wiper","value":"intermittent rear wiper"},{"name":"Intermittent Front Wipers","value":"variable intermittent"},{"name":"Rear Defogger","value":"rear defogger"}]},{"id":"20072640545","name":"Steering Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Steering Wheel Adjustments","value":"tilt and telescopic"},{"name":"Cruise Controls On Steering Wheel","value":"cruise controls"},{"name":"Steering Wheel Trim","value":"leather and simulated alloy"},{"name":"Audio Controls On Steering Wheel","value":"audio controls"},{"name":"Phone Controls On Steering Wheel","value":"phone controls on steering wheel"}]},{"id":"20072640548","name":"Storage","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cupholders Location","value":"front and rear"},{"name":"Seatback Storage","value":"front seatback storage"},{"name":"Door Pockets Location","value":"front and rear"},{"name":"Overhead Console","value":"overhead console with storage"},{"name":"Center Console","value":"front console with storage"}]},{"id":"20072640549","name":"Sunroof","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"One Touch Power Sunroof","value":"one-touch power sunroof"},{"name":"Sunroof","value":"power glass"}]},{"id":"20072640550","name":"Seating Configuration","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seating Capacity","value":"2"},{"name":"2nd Row Seating Capacity","value":"3"}]},{"id":"20072640551","name":"Air Conditioning","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Air Conditioning Zones","value":"dual"},{"name":"Front Air Conditioning","value":"automatic climate control"},{"name":"Rear Heat","value":"rear ventilation ducts"},{"name":"Air Filtration","value":"interior air filtration"}]},{"id":"20072640552","name":"Differential","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Final Drive Ratio","value":"4.62"},{"name":"Limited Slip Center Differential","value":"limited slip center differential"}]},{"id":"20072640553","name":"Seatbelts","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Center Seatbelt","value":"3-point belt"}]},{"id":"20072640554","name":"Suspension","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Suspension Classification","value":"independent"},{"name":"Rear Spring Type","value":"coil springs"},{"name":"Independent Suspension","value":"four-wheel"},{"name":"Rear Suspension Classification","value":"independent"},{"name":"Front Stabilizer Bar","value":"stabilizer bar"},{"name":"Front Spring Type","value":"coil springs"},{"name":"Rear Stabilizer Bar","value":"stabilizer bar"}]},{"id":"20072640556","name":"Specifications","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Gross Vehicle Weight","value":"4566"},{"name":"Ege Highway Mpg","value":"30"},{"name":"Epa City Mpg","value":"24"},{"name":"Fuel Capacity","value":"15.3"},{"name":"Ege Combined Mpg","value":"26"},{"name":"Manufacturer 0 60mph Acceleration Time (seconds)","value":"7.8"},{"name":"Epa Highway Mpg","value":"30"},{"name":"Epa Combined Mpg","value":"26"},{"name":"Payload","value":"977"},{"name":"Curb Weight","value":"3589"},{"name":"Turning Diameter","value":"36.7"},{"name":"Tco Curb Weight","value":"3589"},{"name":"Ege City Mpg","value":"24"},{"name":"Towing Capacity","value":"2000"}]},{"id":"20072640557","name":"Brake System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Brake Type","value":"disc"},{"name":"Front Brake Type","value":"ventilated disc"},{"name":"Antilock Braking System","value":"4-wheel ABS"},{"name":"Braking Assist","value":"braking assist"}]},{"id":"20072640558","name":"Drive Type","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Driven Wheels","value":"all wheel drive"}]},{"id":"20072640559","name":"Misc. Interior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cruise Control","value":"cruise control"},{"name":"Floor Mats","value":"floor mats"},{"name":"Floor Mat Material","value":"carpet"}]},{"id":"20072640560","name":"Collision Safety System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Accident Avoidance System","value":"blind spot warning"},{"name":"Post Collision Safety System","value":"post-collision safety system"}]},{"id":"20072640562","name":"Driver Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Driver Seat","value":"height adjustable"},{"name":"Driver Seat Adjustable Lumbar","value":"power adjustable lumbar support"},{"name":"Number Of Driver Seat Power Adjustments","value":"6"},{"name":"Heated Driver Seat","value":"multi-level heating"}]},{"id":"20072640563","name":"Security","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Engine Immobilizer","value":"engine immobilizer"},{"name":"Power Door Locks","value":"hands-free entry"},{"name":"Anti Theft Alarm System","value":"remote anti-theft alarm system"}]},{"id":"20072640565","name":"Airbags","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Head Airbags","value":"front and rear"},{"name":"Passenger Airbag Deactivation","value":"occupant sensing deactivation"},{"name":"Side Curtain Airbag Rollover Sensor","value":"side-curtain airbag rollover sensor"},{"name":"Side Airbags","value":"dual front"}]},{"id":"20072640566","name":"2nd Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Folding 2nd Row","value":"split folding"},{"name":"2nd Row Seat Type","value":"bench"},{"name":"Adjustable 2nd Row Headrests","value":"height adjustable headrests"},{"name":"Number Of 2nd Row Headrests","value":"3"},{"name":"2nd Row Center Armrest","value":"folding"}]}],"equipmentCount":31}
What I'd like to accomplish is to get the value of any 'name' key in the map I've created, but I can't figure out the right way to do it (first time I've tried anything like this).  Ideally I'd like to only pull in the 'name' values that also match to an 'availability' of Standard, but I'll settle for just getting all the names and trying to filter them from there.  I know what I have currently is obviously wrong as I'm only ending up with 2 items in my features list when I run it, when it should be more like 31, but that configuration was the only way I was able to pull anything close to what I'm looking for.  Any help would be greatly appreciated as I've been banging my head against this longer than I'd care to admit today.

Thanks
Best Answer chosen by Carter85
UC InnovationUC Innovation
Give this a try. It works for me in Anonymous Apex:
 
public class Attributes {
	public String name;
	public String value;
}

public class Equipment {
	public String id;
	public String name;
	public String equipmentType;
	public String availability;
	public List<Attributes> attributes;
}

public class EdmundsResponse {
	public List<Equipment> equipment;
	public Integer equipmentCount;
}

public List<String> features  {get;set;}


String jsonString = '{\"equipment\":[{\"id\":\"20072640525\",\"name\":\"Cargo Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cargo Capacity, All Seats In Place\",\"value\":\"34.1\"},{\"name\":\"Cargo Capacity, Rear Seat Down Or Removed\",\"value\":\"65.4\"},{\"name\":\"Max Cargo Capacity\",\"value\":\"65.4\"}]},{\"id\":\"20072640526\",\"name\":\"Mobile Connectivity\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Satellite Communications\",\"value\":\"MAZDA CONNECT\"},{\"name\":\"Bluetooth\",\"value\":\"Bluetooth\"}]},{\"id\":\"20072640528\",\"name\":\"Instrumentation\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"External Temperature Gauge\",\"value\":\"external temperature display\"},{\"name\":\"Tire Pressure Monitoring System\",\"value\":\"tire pressure monitoring\"},{\"name\":\"Tachometer\",\"value\":\"tachometer\"},{\"name\":\"Trip Computer\",\"value\":\"trip computer\"},{\"name\":\"Clock\",\"value\":\"clock\"}]},{\"id\":\"20072640529\",\"name\":\"Misc. Exterior Features\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Rear Spoiler\",\"value\":\"rear spoiler\"},{\"name\":\"Exterior Camera\",\"value\":\"rear view camera\"}]},{\"id\":\"20072640530\",\"name\":\"Doors\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Liftgate Window\",\"value\":\"fixed\"},{\"name\":\"Rear Door Type\",\"value\":\"liftgate\"},{\"name\":\"Number Of Doors\",\"value\":\"4\"}]},{\"id\":\"20072640531\",\"name\":\"Exterior Lights\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Fog Lights\",\"value\":\"front fog/driving lights\"},{\"name\":\"Headlights Auto Delay\",\"value\":\"auto delay off\"},{\"name\":\"Daytime Running Lights\",\"value\":\"daytime running lights\"},{\"name\":\"Headlights Dusk Sensor\",\"value\":\"dusk sensing\"}]},{\"id\":\"20072640534\",\"name\":\"Front Passenger Seat\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Height Adjustable Passenger Seat\",\"value\":\"height adjustable\"},{\"name\":\"Number Of Passenger Seat Manual Adjustments\",\"value\":\"6\"},{\"name\":\"Heated Passenger Seat\",\"value\":\"multi-level heating\"}]},{\"id\":\"20072640536\",\"name\":\"Steering\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Power Steering\",\"value\":\"electric power steering\"}]},{\"id\":\"20072640537\",\"name\":\"1st Row Seats\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"1st Row Seat Type\",\"value\":\"bucket\"},{\"name\":\"Adjustable Seat Headrest\",\"value\":\"height adjustable headrests\"},{\"name\":\"1st Row Upholstery\",\"value\":\"leather\"},{\"name\":\"Number Of 1st Row Headrests\",\"value\":\"2\"},{\"name\":\"Seat Whiplash Protection\",\"value\":\"whiplash protection system\"}]},{\"id\":\"20072640538\",\"name\":\"Interior Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"2nd Row Leg Room\",\"value\":\"39.3\"},{\"name\":\"1st Row Hip Room\",\"value\":\"55.2\"},{\"name\":\"2nd Row Shoulder Room\",\"value\":\"55.5\"},{\"name\":\"1st Row Head Room\",\"value\":\"39.0\"},{\"name\":\"1st Row Leg Room\",\"value\":\"41.0\"},{\"name\":\"2nd Row Head Room\",\"value\":\"39.0\"},{\"name\":\"2nd Row Hip Room\",\"value\":\"53.7\"},{\"name\":\"Epa Interior Volume\",\"value\":\"136.4\"},{\"name\":\"1st Row Shoulder Room\",\"value\":\"57.5\"}]},{\"id\":\"20072640539\",\"name\":\"Spare Tire/Wheel\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Spare Tire Mount Location\",\"value\":\"inside\"},{\"name\":\"Spare Tire Size\",\"value\":\"temporary\"}]},{\"id\":\"20072640541\",\"name\":\"Power Outlets\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Power Outlet(s)\",\"value\":\"12V\"}]},{\"id\":\"20072640543\",\"name\":\"Exterior Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Overall Width Without Mirrors\",\"value\":\"72.4\"},{\"name\":\"Wheelbase\",\"value\":\"106.3\"},{\"name\":\"Minimum Ground Clearance\",\"value\":\"8.5\"},{\"name\":\"Overall Length\",\"value\":\"179.3\"},{\"name\":\"Overall Height\",\"value\":\"67.3\"}]},{\"id\":\"20072640544\",\"name\":\"Windows\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Privacy Glass\",\"value\":\"privacy glass\"},{\"name\":\"Rain Sensing Front Wipers\",\"value\":\"rain sensing\"},{\"name\":\"One Touch Windows\",\"value\":\"1\"},{\"name\":\"Power Windows\",\"value\":\"power windows\"},{\"name\":\"Rear Wiper\",\"value\":\"intermittent rear wiper\"},{\"name\":\"Intermittent Front Wipers\",\"value\":\"variable intermittent\"},{\"name\":\"Rear Defogger\",\"value\":\"rear defogger\"}]},{\"id\":\"20072640545\",\"name\":\"Steering Wheel\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Steering Wheel Adjustments\",\"value\":\"tilt and telescopic\"},{\"name\":\"Cruise Controls On Steering Wheel\",\"value\":\"cruise controls\"},{\"name\":\"Steering Wheel Trim\",\"value\":\"leather and simulated alloy\"},{\"name\":\"Audio Controls On Steering Wheel\",\"value\":\"audio controls\"},{\"name\":\"Phone Controls On Steering Wheel\",\"value\":\"phone controls on steering wheel\"}]},{\"id\":\"20072640548\",\"name\":\"Storage\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cupholders Location\",\"value\":\"front and rear\"},{\"name\":\"Seatback Storage\",\"value\":\"front seatback storage\"},{\"name\":\"Door Pockets Location\",\"value\":\"front and rear\"},{\"name\":\"Overhead Console\",\"value\":\"overhead console with storage\"},{\"name\":\"Center Console\",\"value\":\"front console with storage\"}]},{\"id\":\"20072640549\",\"name\":\"Sunroof\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"One Touch Power Sunroof\",\"value\":\"one-touch power sunroof\"},{\"name\":\"Sunroof\",\"value\":\"power glass\"}]},{\"id\":\"20072640550\",\"name\":\"Seating Configuration\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"1st Row Seating Capacity\",\"value\":\"2\"},{\"name\":\"2nd Row Seating Capacity\",\"value\":\"3\"}]},{\"id\":\"20072640551\",\"name\":\"Air Conditioning\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Air Conditioning Zones\",\"value\":\"dual\"},{\"name\":\"Front Air Conditioning\",\"value\":\"automatic climate control\"},{\"name\":\"Rear Heat\",\"value\":\"rear ventilation ducts\"},{\"name\":\"Air Filtration\",\"value\":\"interior air filtration\"}]},{\"id\":\"20072640552\",\"name\":\"Differential\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Final Drive Ratio\",\"value\":\"4.62\"},{\"name\":\"Limited Slip Center Differential\",\"value\":\"limited slip center differential\"}]},{\"id\":\"20072640553\",\"name\":\"Seatbelts\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"2nd Row Center Seatbelt\",\"value\":\"3-point belt\"}]},{\"id\":\"20072640554\",\"name\":\"Suspension\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Suspension Classification\",\"value\":\"independent\"},{\"name\":\"Rear Spring Type\",\"value\":\"coil springs\"},{\"name\":\"Independent Suspension\",\"value\":\"four-wheel\"},{\"name\":\"Rear Suspension Classification\",\"value\":\"independent\"},{\"name\":\"Front Stabilizer Bar\",\"value\":\"stabilizer bar\"},{\"name\":\"Front Spring Type\",\"value\":\"coil springs\"},{\"name\":\"Rear Stabilizer Bar\",\"value\":\"stabilizer bar\"}]},{\"id\":\"20072640556\",\"name\":\"Specifications\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Gross Vehicle Weight\",\"value\":\"4566\"},{\"name\":\"Ege Highway Mpg\",\"value\":\"30\"},{\"name\":\"Epa City Mpg\",\"value\":\"24\"},{\"name\":\"Fuel Capacity\",\"value\":\"15.3\"},{\"name\":\"Ege Combined Mpg\",\"value\":\"26\"},{\"name\":\"Manufacturer 0 60mph Acceleration Time (seconds)\",\"value\":\"7.8\"},{\"name\":\"Epa Highway Mpg\",\"value\":\"30\"},{\"name\":\"Epa Combined Mpg\",\"value\":\"26\"},{\"name\":\"Payload\",\"value\":\"977\"},{\"name\":\"Curb Weight\",\"value\":\"3589\"},{\"name\":\"Turning Diameter\",\"value\":\"36.7\"},{\"name\":\"Tco Curb Weight\",\"value\":\"3589\"},{\"name\":\"Ege City Mpg\",\"value\":\"24\"},{\"name\":\"Towing Capacity\",\"value\":\"2000\"}]},{\"id\":\"20072640557\",\"name\":\"Brake System\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Rear Brake Type\",\"value\":\"disc\"},{\"name\":\"Front Brake Type\",\"value\":\"ventilated disc\"},{\"name\":\"Antilock Braking System\",\"value\":\"4-wheel ABS\"},{\"name\":\"Braking Assist\",\"value\":\"braking assist\"}]},{\"id\":\"20072640558\",\"name\":\"Drive Type\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Driven Wheels\",\"value\":\"all wheel drive\"}]},{\"id\":\"20072640559\",\"name\":\"Misc. Interior Features\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cruise Control\",\"value\":\"cruise control\"},{\"name\":\"Floor Mats\",\"value\":\"floor mats\"},{\"name\":\"Floor Mat Material\",\"value\":\"carpet\"}]},{\"id\":\"20072640560\",\"name\":\"Collision Safety System\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Accident Avoidance System\",\"value\":\"blind spot warning\"},{\"name\":\"Post Collision Safety System\",\"value\":\"post-collision safety system\"}]},{\"id\":\"20072640562\",\"name\":\"Driver Seat\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Height Adjustable Driver Seat\",\"value\":\"height adjustable\"},{\"name\":\"Driver Seat Adjustable Lumbar\",\"value\":\"power adjustable lumbar support\"},{\"name\":\"Number Of Driver Seat Power Adjustments\",\"value\":\"6\"},{\"name\":\"Heated Driver Seat\",\"value\":\"multi-level heating\"}]},{\"id\":\"20072640563\",\"name\":\"Security\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Engine Immobilizer\",\"value\":\"engine immobilizer\"},{\"name\":\"Power Door Locks\",\"value\":\"hands-free entry\"},{\"name\":\"Anti Theft Alarm System\",\"value\":\"remote anti-theft alarm system\"}]},{\"id\":\"20072640565\",\"name\":\"Airbags\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Head Airbags\",\"value\":\"front and rear\"},{\"name\":\"Passenger Airbag Deactivation\",\"value\":\"occupant sensing deactivation\"},{\"name\":\"Side Curtain Airbag Rollover Sensor\",\"value\":\"side-curtain airbag rollover sensor\"},{\"name\":\"Side Airbags\",\"value\":\"dual front\"}]},{\"id\":\"20072640566\",\"name\":\"2nd Row Seats\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Folding 2nd Row\",\"value\":\"split folding\"},{\"name\":\"2nd Row Seat Type\",\"value\":\"bench\"},{\"name\":\"Adjustable 2nd Row Headrests\",\"value\":\"height adjustable headrests\"},{\"name\":\"Number Of 2nd Row Headrests\",\"value\":\"3\"},{\"name\":\"2nd Row Center Armrest\",\"value\":\"folding\"}]}],\"equipmentCount\":31}';

    	
EdmundsResponse response = (EdmundsResponse)JSON.deserialize(jsonString, EdmundsResponse.class);

System.Debug('reponse: ' + response);
System.Debug('equipmentCount: ' + response.equipmentCount);

List<Equipment> equipList = response.equipment;

for (Equipment equip : equipList) {
	List<Attributes> attribList = equip.attributes;

	System.Debug('equip: ' + equip);

	for (Attributes attrib : attribList) {
		System.Debug('attrib: ' + attrib);
		System.Debug('name: ' + attrib.name);
	}
}

 

All Answers

UC InnovationUC Innovation
Give this a try. It works for me in Anonymous Apex:
 
public class Attributes {
	public String name;
	public String value;
}

public class Equipment {
	public String id;
	public String name;
	public String equipmentType;
	public String availability;
	public List<Attributes> attributes;
}

public class EdmundsResponse {
	public List<Equipment> equipment;
	public Integer equipmentCount;
}

public List<String> features  {get;set;}


String jsonString = '{\"equipment\":[{\"id\":\"20072640525\",\"name\":\"Cargo Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cargo Capacity, All Seats In Place\",\"value\":\"34.1\"},{\"name\":\"Cargo Capacity, Rear Seat Down Or Removed\",\"value\":\"65.4\"},{\"name\":\"Max Cargo Capacity\",\"value\":\"65.4\"}]},{\"id\":\"20072640526\",\"name\":\"Mobile Connectivity\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Satellite Communications\",\"value\":\"MAZDA CONNECT\"},{\"name\":\"Bluetooth\",\"value\":\"Bluetooth\"}]},{\"id\":\"20072640528\",\"name\":\"Instrumentation\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"External Temperature Gauge\",\"value\":\"external temperature display\"},{\"name\":\"Tire Pressure Monitoring System\",\"value\":\"tire pressure monitoring\"},{\"name\":\"Tachometer\",\"value\":\"tachometer\"},{\"name\":\"Trip Computer\",\"value\":\"trip computer\"},{\"name\":\"Clock\",\"value\":\"clock\"}]},{\"id\":\"20072640529\",\"name\":\"Misc. Exterior Features\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Rear Spoiler\",\"value\":\"rear spoiler\"},{\"name\":\"Exterior Camera\",\"value\":\"rear view camera\"}]},{\"id\":\"20072640530\",\"name\":\"Doors\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Liftgate Window\",\"value\":\"fixed\"},{\"name\":\"Rear Door Type\",\"value\":\"liftgate\"},{\"name\":\"Number Of Doors\",\"value\":\"4\"}]},{\"id\":\"20072640531\",\"name\":\"Exterior Lights\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Fog Lights\",\"value\":\"front fog/driving lights\"},{\"name\":\"Headlights Auto Delay\",\"value\":\"auto delay off\"},{\"name\":\"Daytime Running Lights\",\"value\":\"daytime running lights\"},{\"name\":\"Headlights Dusk Sensor\",\"value\":\"dusk sensing\"}]},{\"id\":\"20072640534\",\"name\":\"Front Passenger Seat\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Height Adjustable Passenger Seat\",\"value\":\"height adjustable\"},{\"name\":\"Number Of Passenger Seat Manual Adjustments\",\"value\":\"6\"},{\"name\":\"Heated Passenger Seat\",\"value\":\"multi-level heating\"}]},{\"id\":\"20072640536\",\"name\":\"Steering\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Power Steering\",\"value\":\"electric power steering\"}]},{\"id\":\"20072640537\",\"name\":\"1st Row Seats\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"1st Row Seat Type\",\"value\":\"bucket\"},{\"name\":\"Adjustable Seat Headrest\",\"value\":\"height adjustable headrests\"},{\"name\":\"1st Row Upholstery\",\"value\":\"leather\"},{\"name\":\"Number Of 1st Row Headrests\",\"value\":\"2\"},{\"name\":\"Seat Whiplash Protection\",\"value\":\"whiplash protection system\"}]},{\"id\":\"20072640538\",\"name\":\"Interior Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"2nd Row Leg Room\",\"value\":\"39.3\"},{\"name\":\"1st Row Hip Room\",\"value\":\"55.2\"},{\"name\":\"2nd Row Shoulder Room\",\"value\":\"55.5\"},{\"name\":\"1st Row Head Room\",\"value\":\"39.0\"},{\"name\":\"1st Row Leg Room\",\"value\":\"41.0\"},{\"name\":\"2nd Row Head Room\",\"value\":\"39.0\"},{\"name\":\"2nd Row Hip Room\",\"value\":\"53.7\"},{\"name\":\"Epa Interior Volume\",\"value\":\"136.4\"},{\"name\":\"1st Row Shoulder Room\",\"value\":\"57.5\"}]},{\"id\":\"20072640539\",\"name\":\"Spare Tire/Wheel\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Spare Tire Mount Location\",\"value\":\"inside\"},{\"name\":\"Spare Tire Size\",\"value\":\"temporary\"}]},{\"id\":\"20072640541\",\"name\":\"Power Outlets\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Power Outlet(s)\",\"value\":\"12V\"}]},{\"id\":\"20072640543\",\"name\":\"Exterior Dimensions\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Overall Width Without Mirrors\",\"value\":\"72.4\"},{\"name\":\"Wheelbase\",\"value\":\"106.3\"},{\"name\":\"Minimum Ground Clearance\",\"value\":\"8.5\"},{\"name\":\"Overall Length\",\"value\":\"179.3\"},{\"name\":\"Overall Height\",\"value\":\"67.3\"}]},{\"id\":\"20072640544\",\"name\":\"Windows\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Privacy Glass\",\"value\":\"privacy glass\"},{\"name\":\"Rain Sensing Front Wipers\",\"value\":\"rain sensing\"},{\"name\":\"One Touch Windows\",\"value\":\"1\"},{\"name\":\"Power Windows\",\"value\":\"power windows\"},{\"name\":\"Rear Wiper\",\"value\":\"intermittent rear wiper\"},{\"name\":\"Intermittent Front Wipers\",\"value\":\"variable intermittent\"},{\"name\":\"Rear Defogger\",\"value\":\"rear defogger\"}]},{\"id\":\"20072640545\",\"name\":\"Steering Wheel\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Steering Wheel Adjustments\",\"value\":\"tilt and telescopic\"},{\"name\":\"Cruise Controls On Steering Wheel\",\"value\":\"cruise controls\"},{\"name\":\"Steering Wheel Trim\",\"value\":\"leather and simulated alloy\"},{\"name\":\"Audio Controls On Steering Wheel\",\"value\":\"audio controls\"},{\"name\":\"Phone Controls On Steering Wheel\",\"value\":\"phone controls on steering wheel\"}]},{\"id\":\"20072640548\",\"name\":\"Storage\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cupholders Location\",\"value\":\"front and rear\"},{\"name\":\"Seatback Storage\",\"value\":\"front seatback storage\"},{\"name\":\"Door Pockets Location\",\"value\":\"front and rear\"},{\"name\":\"Overhead Console\",\"value\":\"overhead console with storage\"},{\"name\":\"Center Console\",\"value\":\"front console with storage\"}]},{\"id\":\"20072640549\",\"name\":\"Sunroof\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"One Touch Power Sunroof\",\"value\":\"one-touch power sunroof\"},{\"name\":\"Sunroof\",\"value\":\"power glass\"}]},{\"id\":\"20072640550\",\"name\":\"Seating Configuration\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"1st Row Seating Capacity\",\"value\":\"2\"},{\"name\":\"2nd Row Seating Capacity\",\"value\":\"3\"}]},{\"id\":\"20072640551\",\"name\":\"Air Conditioning\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Air Conditioning Zones\",\"value\":\"dual\"},{\"name\":\"Front Air Conditioning\",\"value\":\"automatic climate control\"},{\"name\":\"Rear Heat\",\"value\":\"rear ventilation ducts\"},{\"name\":\"Air Filtration\",\"value\":\"interior air filtration\"}]},{\"id\":\"20072640552\",\"name\":\"Differential\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Final Drive Ratio\",\"value\":\"4.62\"},{\"name\":\"Limited Slip Center Differential\",\"value\":\"limited slip center differential\"}]},{\"id\":\"20072640553\",\"name\":\"Seatbelts\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"2nd Row Center Seatbelt\",\"value\":\"3-point belt\"}]},{\"id\":\"20072640554\",\"name\":\"Suspension\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Front Suspension Classification\",\"value\":\"independent\"},{\"name\":\"Rear Spring Type\",\"value\":\"coil springs\"},{\"name\":\"Independent Suspension\",\"value\":\"four-wheel\"},{\"name\":\"Rear Suspension Classification\",\"value\":\"independent\"},{\"name\":\"Front Stabilizer Bar\",\"value\":\"stabilizer bar\"},{\"name\":\"Front Spring Type\",\"value\":\"coil springs\"},{\"name\":\"Rear Stabilizer Bar\",\"value\":\"stabilizer bar\"}]},{\"id\":\"20072640556\",\"name\":\"Specifications\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Gross Vehicle Weight\",\"value\":\"4566\"},{\"name\":\"Ege Highway Mpg\",\"value\":\"30\"},{\"name\":\"Epa City Mpg\",\"value\":\"24\"},{\"name\":\"Fuel Capacity\",\"value\":\"15.3\"},{\"name\":\"Ege Combined Mpg\",\"value\":\"26\"},{\"name\":\"Manufacturer 0 60mph Acceleration Time (seconds)\",\"value\":\"7.8\"},{\"name\":\"Epa Highway Mpg\",\"value\":\"30\"},{\"name\":\"Epa Combined Mpg\",\"value\":\"26\"},{\"name\":\"Payload\",\"value\":\"977\"},{\"name\":\"Curb Weight\",\"value\":\"3589\"},{\"name\":\"Turning Diameter\",\"value\":\"36.7\"},{\"name\":\"Tco Curb Weight\",\"value\":\"3589\"},{\"name\":\"Ege City Mpg\",\"value\":\"24\"},{\"name\":\"Towing Capacity\",\"value\":\"2000\"}]},{\"id\":\"20072640557\",\"name\":\"Brake System\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Rear Brake Type\",\"value\":\"disc\"},{\"name\":\"Front Brake Type\",\"value\":\"ventilated disc\"},{\"name\":\"Antilock Braking System\",\"value\":\"4-wheel ABS\"},{\"name\":\"Braking Assist\",\"value\":\"braking assist\"}]},{\"id\":\"20072640558\",\"name\":\"Drive Type\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Driven Wheels\",\"value\":\"all wheel drive\"}]},{\"id\":\"20072640559\",\"name\":\"Misc. Interior Features\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Cruise Control\",\"value\":\"cruise control\"},{\"name\":\"Floor Mats\",\"value\":\"floor mats\"},{\"name\":\"Floor Mat Material\",\"value\":\"carpet\"}]},{\"id\":\"20072640560\",\"name\":\"Collision Safety System\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Accident Avoidance System\",\"value\":\"blind spot warning\"},{\"name\":\"Post Collision Safety System\",\"value\":\"post-collision safety system\"}]},{\"id\":\"20072640562\",\"name\":\"Driver Seat\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Height Adjustable Driver Seat\",\"value\":\"height adjustable\"},{\"name\":\"Driver Seat Adjustable Lumbar\",\"value\":\"power adjustable lumbar support\"},{\"name\":\"Number Of Driver Seat Power Adjustments\",\"value\":\"6\"},{\"name\":\"Heated Driver Seat\",\"value\":\"multi-level heating\"}]},{\"id\":\"20072640563\",\"name\":\"Security\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Engine Immobilizer\",\"value\":\"engine immobilizer\"},{\"name\":\"Power Door Locks\",\"value\":\"hands-free entry\"},{\"name\":\"Anti Theft Alarm System\",\"value\":\"remote anti-theft alarm system\"}]},{\"id\":\"20072640565\",\"name\":\"Airbags\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Head Airbags\",\"value\":\"front and rear\"},{\"name\":\"Passenger Airbag Deactivation\",\"value\":\"occupant sensing deactivation\"},{\"name\":\"Side Curtain Airbag Rollover Sensor\",\"value\":\"side-curtain airbag rollover sensor\"},{\"name\":\"Side Airbags\",\"value\":\"dual front\"}]},{\"id\":\"20072640566\",\"name\":\"2nd Row Seats\",\"equipmentType\":\"OTHER\",\"availability\":\"STANDARD\",\"attributes\":[{\"name\":\"Folding 2nd Row\",\"value\":\"split folding\"},{\"name\":\"2nd Row Seat Type\",\"value\":\"bench\"},{\"name\":\"Adjustable 2nd Row Headrests\",\"value\":\"height adjustable headrests\"},{\"name\":\"Number Of 2nd Row Headrests\",\"value\":\"3\"},{\"name\":\"2nd Row Center Armrest\",\"value\":\"folding\"}]}],\"equipmentCount\":31}';

    	
EdmundsResponse response = (EdmundsResponse)JSON.deserialize(jsonString, EdmundsResponse.class);

System.Debug('reponse: ' + response);
System.Debug('equipmentCount: ' + response.equipmentCount);

List<Equipment> equipList = response.equipment;

for (Equipment equip : equipList) {
	List<Attributes> attribList = equip.attributes;

	System.Debug('equip: ' + equip);

	for (Attributes attrib : attribList) {
		System.Debug('attrib: ' + attrib);
		System.Debug('name: ' + attrib.name);
	}
}

 
This was selected as the best answer
Carter85Carter85
Wow, that is exactly what I needed.  Thank you so much fo the assistance, and with such a more elegant way than I was trying to go about it.
UC InnovationUC Innovation
No problem.  Good luck with the integration!