我有一个数据,其中一列为 json 字符串:
reservation reasons
1592 [{"name"=>"jorge", "value"=>"MX"}, {"name"=>"Billing phone number", "value"=>"1123"}, {"name"=>"BillingCountry", "value"=>"USA"}]
1597 [{"name"=>"BillingAddress_Country", "value"=>"IN"}, {"name"=>"Billing phone number country code", "value"=>"IN"}, {"name"=>"Latest amount", "value"=>"583000000"}]
我想按如下方式解析该列:
reservation name value
1592 jorge mx
1592 Billing phone number 1123
1592 BillingCountry USA
1597 BillingAddress_Country IN
1597 Billing phone number country code IN
1597 Latest amount 583000000
我是我们
我在 R 中使用 jsonlite 。我的代码中出现以下错误:
data<-read.csv("data.csv")
json<-data$reasons
mydf <- fromJSON(json)
Error: Argument 'txt' must be a JSON string, URL or file.
谁能告诉我我在哪里犯了错误?我需要做哪些修改?提前谢谢了!