I cannot open this in excel as well as this is JSON format data which i am converting into dataframe from POST Api
Below is sample data in JSON format which i need in the dataframe
[
{
"DivisionId": 20,
"PrimoId": 73413,
"Wits": "0113",
"Ename": "IRK_DRILLING",
"Sname": "RATE_OF_PENETRATION",
"Adname": "Depth",
"Array": {
"Size": 1733,
"Mds": [
2,
4,
5,
9,
12,
],
"Tms": null,
"Vls": [
0.26,
0.13,
0.88,
4.91,
9.71,
],
"Ads": null
}
},
{
"DivisionId": 56,
"PrimoId": 88245,
"Wits": "0115",
"Ename": "IRK_DRILLING",
"Sname": "HOOK_LOAD",
"Adname": "Depth",
"Array": {
"Size": 1892,
"Mds": [
3546.99,
3547,
3548,
3549,
3550,
],
"Tms": null,
"Vls": [
-999.25,
43.04,
110.8,
107.83,
108.61,
],
"Ads": null
}
}
]
Code i used
resultRaw <- content(r, as = "text")
dt <- fromJSON(resultRaw)
testB2 <-
-
data.frame(
-
DivisionId=unlist(dt$DivisionId),
-
PrimoId=unlist(dt$PrimoId),
-
Wits=unlist(dt$Wits),
-
Adname=unlist(dt$Adname),
-
Mds = unlist(dt$Array$Mds),
-
Tms = unlist(dt$Array$Tms),
-
Vls = unlist(dt$Array$Vls),
-
Ads = unlist(dt$Array$Ads))
Error in data.frame(DivisionId = unlist(dt$DivisionId), PrimoId = unlist(dt$PrimoId), :
arguments imply differing number of rows: 2, 3625