I'm trying pull select arrays from a JSON object using the developer version of the R tidyjson package. I'd like to create the example table below from the example JSON object below. Any help on this would be greatly appreciated.
Here is the table I'm trying to create:
document.id location.lat location.lng viewport name place_id
1 32.123451 -85.234541 northeast Name1 sdfdfasdfasdfdasfdas
1 32.123451 -85.234541 southwest Name1 sdfdfasdfasdfdasfdas
2 33.345454 -84.345454 northeast Name2 sdfdsfdsfdff
2 33.345454 -84.345454 southwest Name2 sdfdsfdsfdff
Here is my JSON object:
JSON_TEST <- "{
\"html_attributions\" : [],
\"results\" : [
{
\"geometry\" : {
\"location\" : {
\"lat\" : 32.123451,
\"lng\" : -85.234541
},
\"viewport\" : {
\"northeast\" : {
\"lat\" : 32.234341,
\"lng\" : -85.345655
},
\"southwest\" : {
\"lat\" : 32.235624,
\"lng\" : -85.234655
}
}
},
\"icon\" : \"https://fake/fake/fake1.png\",
\"id\" : \"qwerqewrqwerqewrqewrqwreqewrqewrqwr\",
\"name\" : \"Name1\",
\"place_id\" : \"sdfdfasdfasdfdasfdas\",
\"reference\" : \"asdfdasfadsfdasfdfdfdffff\",
\"scope\" : \"TEST1\",
\"types\" : [
\"bar\",
\"liquor_store\",
\"food\",
\"store\",
\"point_of_interest\",
\"establishment\"
],
\"vicinity\" : \"343 Fake Place Lane, Atlanta\"
},
{
\"geometry\" : {
\"location\" : {
\"lat\" : 33.345454,
\"lng\" : -84.345454
},
\"viewport\" : {
\"northeast\" : {
\"lat\" : 33.234534
\"lng\" : -84.234643
},
\"southwest\" : {
\"lat\" : 33.345443,
\"lng\" : -84.345422
}
}
},
\"icon\" : \"https://fake/fake/fake2.png\",
\"id\" : \"sdfdsfdsfdff\",
\"name\" : \"Name2\",
\"place_id\" : \"sadfsdfdfdf\",
\"reference\" : \"asdfdasfdsfd\",
\"scope\" : \"TEST2\",
\"types\" : [ \"bar\", \"point_of_interest\", \"establishment\" ],
\"vicinity\" : \"21434 Fake Place Ave, Atlanta\"
}
],
\"status\" : \"OK\"
}
"
googlewaypackage to query the Google Places API directly