0

Can you help me please, I am trying to convert the JSON that returns a google API to a tabular format (dataframe) to export to a CSV or other tabular type.

I have attached a screenshot of the expected result

I have seen several examples on the internet but do not use a nested JSON as the result of Google apis. I greatly appreciate your help and time.

{
"html_attributions": [],
"results": [
    {
        "geometry": {
            "location": {
                "lat": 13.6945775,
                "lng": -89.2110781
            },
            "viewport": {
                "northeast": {
                    "lat": 13.6959703302915,
                    "lng": -89.2097351697085
                },
                "southwest": {
                    "lat": 13.6932723697085,
                    "lng": -89.2124331302915
                }
            }
        },
        "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
        "id": "373c45e64407f28195415a8911015cc8020cea46",
        "name": "Tienda Los Angeles",
        "opening_hours": {
            "open_now": true
        },
        "place_id": "ChIJVznGtFkwY48RSFWKZ3a5eBs",
        "plus_code": {
            "compound_code": "MQVQ+RH San Salvador, El Salvador",
            "global_code": "765GMQVQ+RH"
        },
        "rating": 4,
        "reference": "ChIJVznGtFkwY48RSFWKZ3a5eBs",
        "scope": "GOOGLE",
        "types": [
            "convenience_store",
            "food",
            "store",
            "point_of_interest",
            "establishment"
        ],
        "user_ratings_total": 3,
        "vicinity": "Antigua Calle Ferrocarril 16, San Salvador"
    },
    {
        "geometry": {
            "location": {
                "lat": 13.7007156,
                "lng": -89.224008
            },
            "viewport": {
                "northeast": {
                    "lat": 13.7021389802915,
                    "lng": -89.2226825697085
                },
                "southwest": {
                    "lat": 13.6994410197085,
                    "lng": -89.2253805302915
                }
            }
        },
        "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
        "id": "e4ffa86f54d8f8c24b661cbe509bf625ac8a86be",
        "name": "Ilusión de San Salvador",
        "opening_hours": {
            "open_now": true
        },
        "photos": [
            {
                "height": 250,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/117368568685068785749/photos\">Ilusión de San Salvador</a>"
                ],
                "photo_reference": "CmRaAAAAXTRH8t7LE1rAUD7SOmPZ7Em-pCTUhID6hLUjlm4p6AE8FMdxUsrl8d8V3rtrrnmuAdBPs-Bvo4YAG3W5TMDmo5OjCzYKDIsO-3d0tkNKegT0VXjnwcjEUbHSAH7nA6k5EhDglO5d6tn1k4L0XP_xIDPkGhRhGdyA98DLRTpTj4x2B46V-5bsCw",
                "width": 250
            }
        ],
        "place_id": "ChIJ5zsWbUEwY48Re_44N6JVEX0",
        "plus_code": {
            "compound_code": "PQ2G+79 San Salvador, El Salvador",
            "global_code": "765GPQ2G+79"
        },
        "rating": 4.5,
        "reference": "ChIJ5zsWbUEwY48Re_44N6JVEX0",
        "scope": "GOOGLE",
        "types": [
            "convenience_store",
            "clothing_store",
            "food",
            "store",
            "point_of_interest",
            "establishment"
        ],
        "user_ratings_total": 13,
        "vicinity": "Col Escalón, Alameda Franklin Delano Roosevelt No 3425"
    }
],
"status": "OK"

}

M--
  • 25,431
  • 8
  • 61
  • 93
Erick
  • 1
  • Perhaps if you provide a [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) that would help. – bob1 Jul 11 '19 at 21:53
  • 1
    see `?googleway::access_result` – SymbolixAU Jul 11 '19 at 22:07
  • Cannot see a screenshot - what do you want your results to look like? FYI, there's a command line tool called [```jq```](https://stedolan.github.io/jq/) which is very powerful. It's a good alternative to R if you're simply looking to parse/format JSON files. – dev.null Jul 12 '19 at 01:46

0 Answers0