I am having some difficulty parsing Google's pagespeed JSON response into a dataframe in R. Ideally I just want the dataframe to contain the speed metrics.
Code to get JSON response.
'''
library(httr)
library(jsonlite)
library(tidyverse)
library(rjson)
url <- "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://www.google.com"
raw_json <- url %>%
httr::GET() %>%
httr::content()
df_pagespeed <- fromJSON(raw_json$lighthouseResult %>% str(max.level = 2))
'''
I get the following error '''
json_str must be a character string
'''