Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
ToJSON(text)
A function that "escapes" text to a JSON string:

Backspace is replaced with \b.
Form feed is replaced with \f.
Newline is replaced with \n.
Carriage return is replaced with \r.
Tab is replaced with \t.
Double quote is replaced with \"
Backslash is replaced with \\
ID
1408
Category
TeamDesk
Author

Robert Gustavsson
Date Created
2/12/2021 3:26:25 AM
Date Updated
2/12/2021 8:15:41 AM
Status
Implemented
Score
20
Promoted By
Patricio BustosRobert Gustavsson
Comments
Kirill Bondar  Staff  2/12/2021 6:29:05 AM
There are two encoding functions we use in Call URL actions -- JSON and JSONFormat.

JSON(text) does just what you propose - encodes special characters in a string.
JSONFormat(text | number | bool | date | time | timestamp) produces JSON represenation for any value type -- quoted string, true, false, properly formatted number etc. Latter allows handling NULLs:

JSONFormat("text") produces string "text"
JSONFormat(null) produces word "null"

With best regards,
Kirill
Kirill Bondar  Staff  2/12/2021 6:30:02 AM
I only wonder why you could need it as in Call URL actions all encoding happens automatically.
Robert Gustavsson 2/12/2021 8:05:53 AM
I'm using a column summary (concatenation) to create multiple JSON rows, thus I can't rely on "call URL" to format at the top level.
Robert Gustavsson 2/12/2021 8:15:41 AM
Thanks Kirill, the secret JSON() function seems to works.
Feedback
 
Back to Search Results