Dear all,
I'm trying to import data through an API that outputs JSON. My problem is the format of the file:
{"error":[],"result":{"NameOfDatasource":[["v1[1]","v2[1]","v3[1]"],["v1[2]","v2[2]","v3[2]"],"v1[...]","v2[n]","v3[n]","v1[n]","v2[n]","v3[n]"]] ,"DataIDontNeed":""}}
My challenge is to import all observations of v1-v3 into Stata. Using insheetjson, I can select table "result" and column "NameOfDatasource", but I can't find a way to get to the vars directly. I can specify:
but this only gives me one observation at a time. As a workaround, I now just save the file to disk, then circle through each obs with a second insheetjson call in my do file to write the data to my Stata file line by line, but this is very slow and I am sure there is an easier way - I just couldn't find it. The aoa option also doesn't seem to work here, although I may be mis-specifying..
Many thanks in advance for any hints!
I'm trying to import data through an API that outputs JSON. My problem is the format of the file:
{"error":[],"result":{"NameOfDatasource":[["v1[1]","v2[1]","v3[1]"],["v1[2]","v2[2]","v3[2]"],"v1[...]","v2[n]","v3[n]","v1[n]","v2[n]","v3[n]"]] ,"DataIDontNeed":""}}
My challenge is to import all observations of v1-v3 into Stata. Using insheetjson, I can select table "result" and column "NameOfDatasource", but I can't find a way to get to the vars directly. I can specify:
Code:
insheetjson v1 v2 v3 using "URL", table("result") columns("NameOfDatasource:`obs':3")
Many thanks in advance for any hints!
Comment