How to generate a .json file or save to variable QueryToJSON() ?

129 views
Skip to first unread message

Gary Hicks

unread,
Sep 9, 2013, 12:29:26 PM9/9/13
to asp...@googlegroups.com
Hi,

I presumed I could output QueryToJSON() to a variable (ultimately to a file), but I do not know how to manage the .Flush sub which renders the output instead:

<%
'My .json file:
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile(Server.MapPath("/data/json/tasks.json"),true)

'Output the results to a variable (for example) and to the .json file:
str=QueryToJSON(cn, "SELECT Project, Description from tblTasks").Flush
fname.WriteLine(str)
%>

As I understand it the .Flush sub renders the contents immediately. Can anyone tell me how to save or handle the data without rendering it?

Please help, your answer is greatly appreciated !!

Gary

andy m

unread,
Dec 6, 2013, 6:29:15 PM12/6/13
to asp...@googlegroups.com
maybe try changing  this line str=QueryToJSON(cn, "SELECT Project, Description from tblTasks").Flush
to
str=
QueryToJSON(cn, "SELECT Project, Description from tblTasks").jsString

Untested.
Reply all
Reply to author
Forward
0 new messages