Using jsonreader with a file
Posted: Mon Mar 25, 2019 10:10 am
Elsewhere in this forum there is a suggested way of accessing json data by saving to a temporary text file then using JSONReader.
I can't work out how to access the data within the loop and I can't find any documentation. I can see the JsonReader has TokenAs... properties but I can't work out how to extract the data using these.
Define_Com Class(#PRIM_IOC.FileStream) Name(#FileStream)
Define_Com Class(#PRIM_IOC.StreamReader) Name(#TextReader) Stream(#FileStream)
Define_Com Class(#XPRIM_File) Name(#TempFile)
#TempFile.CreateTemporaryFile
#Request.Response.AsFile Autodelete(True) Path(#TempFile)
#FileStream.Path := #TempFile
Dowhile Cond(#JsonReader.Read)
* DO your stuff here
Endwhile
I can't work out how to access the data within the loop and I can't find any documentation. I can see the JsonReader has TokenAs... properties but I can't work out how to extract the data using these.
Define_Com Class(#PRIM_IOC.FileStream) Name(#FileStream)
Define_Com Class(#PRIM_IOC.StreamReader) Name(#TextReader) Stream(#FileStream)
Define_Com Class(#XPRIM_File) Name(#TempFile)
#TempFile.CreateTemporaryFile
#Request.Response.AsFile Autodelete(True) Path(#TempFile)
#FileStream.Path := #TempFile
Dowhile Cond(#JsonReader.Read)
* DO your stuff here
Endwhile