Skip to content

Instantly share code, notes, and snippets.

@tanyagupta
Last active October 28, 2017 11:23
Show Gist options
  • Save tanyagupta/2d8a6bc12b851c25f151613aa96077eb to your computer and use it in GitHub Desktop.
Save tanyagupta/2d8a6bc12b851c25f151613aa96077eb to your computer and use it in GitHub Desktop.
Accessing heterogenous JSON data (using &&) - Part 4
function test_and(){
var cars=[
{make: "Jeep",model: "Cherokee",trim:"Sport 4dr Front-wheel Drive",year:"2016",wheel:{wheel_size:"17 x 7.5",wheel_metal:"Aluminum"}},
{make: "Jeep",model: "Wrangler",trim:"Sahara 2dr 4x4",year: "2015"}
]
for (var i in cars){
if (cars[i]["wheel"] && cars[i]["wheel"]["wheel_size"]){
Logger.log(cars[i]["wheel"]["wheel_size"]) // Logger.log() is Google App Script's console.log
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment