Result as L = toJSONFile(TargetFile as C [, RowsToCopy as N [, StartRow as N [, UpperCaseNames as L [, ConvertToText as L [, DateTimeFormat as C [, DateFormat as C [, ReferenceColumns as SQL::TableInfo [, UserContext as P]]]]]]]])
The name of the file to store the JSON, including the file path.
number of rows to use
first row to use
Uppercase names if .T.
If .T. (default) single-quote numeric and logical values
Format string for dateTime values, as used by the time Function, e.g. "yyyy-MM-dd"
Format string for date values, as used by the time Function
When data is formatted for a column in the result set: (1) if ReferenceColumns has a column with a matching name, that object will be used to format the data; (2) otherwise the ColumnInfo property of the result set is used to format the data.
The user context is passed into the evaluation of the expression when data is formatted.
Returns .t. if the operation is successful. Otherwise, returns .f.. If the operation fails, the callResult of the ResultSet object will contain more information.
Convert a ResultSet to JSON object and store in TargetFile
The toJSONFile method converts the SQL::ResultSet object to JSON then saves it in the specified target file. For example:
dim cn as SQL::Connection cn.open("::Name::AADemo-Northwind") if (cn.execute("SELECT * FROM customers") ) then dim filename as c = "C:\Users\YOUR_USER_NAME\Documents\results.js" cn.resultSet.ToJSONFile(filename) ' Display the JSON File: dim contents as c = FILE.to_string(filename) showvar(contents) end if cn.close()