# print_json

Definition: | include builtins\json.e object res = print_json(object fn, object o, bool trim_res=false)
Description: | Converts a JSON object to string representation. fn: an open file handle (1 for the console), or "" to return a string. o: a JSON object to print (see parse_json for details). trim_res: ignored if fn is an integer, otherwise when true strips all whitespace and newlines from the returned result Returns 0 if parameter o is not a valid JSON object, otherwise if fn was originally "", returns a string, else fn unaltered.
pwa/p2js: | Supported.
Notes: | Attempts to print an invalid JSON object yield 0. Note: it may get part way through before detecting an error. The use of a named parameter when setting trim_res is recommended, to make the intent clear and the code easier to read.
See Also: | parse_json