Nested JSON of Google API to table in R

Hello,

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.

Example of JSON returned

{
    "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"
}

It kind of depends on how you want to "flatten" the JSON.
However, jsonlite makes it pretty straight-forward if you like the default behavior of bringing everything to the top.
When you toJSON() there's an option to flatten.
You can also take an existing nested data.frame and use the flatten() function.

I used it for all my Google Maps API calls and never ran into a situation it couldn't handle it.

The getting started vignette is a good start.
Look at the help files for toJSON() to see the flatten option.