the generation is done fully recursive so the value can be a complex datatype as well. e.g.
toJSON("n", array(array(), 2, true), false) or toJSON("n", array(RS, dict, false), false), etc.
name
(
string
)
: name of the value (accessible with javascript afterwards). leave empty to get just the value
val
(
variant int float array object dictionary recordset
)
: value which needs
to be generated. Conversation of the data types (ASP datatype -> Javascript datatype):
NOTHING, NULL -> null, ARRAY -> array, BOOL -> bool, OBJECT -> name of the type,
MULTIDIMENSIONAL ARRAY -> generates a 1 dimensional array (flat) with all values of the multidim array
DICTIONARY -> valuepairs. each key is accessible as property afterwards
RECORDSET -> array where each row of the recordset represents a field in the array.
fields have properties named after the column names of the recordset (LOWERCASED!)
e.g. generate(RS) can be used afterwards r[0].ID
INT, FLOAT -> number
OBJECT with reflect() method -> returned as object which can be used within JavaScript
nested
(
bool
)
: is the value pair already nested within another? if yes then the {} are left out.
Return
(
string
) :
returns a JSON representation of the given name value pair
(if toResponse is on then the return is written directly to the response and nothing is returned)