Escaping Characters

Because the data is going to be enclosed in a string within the array passed through as part of createEvents() special characters will need to be escape using the backslash notation. For example, to include the following special characters:

  • Newlines: \n
  • Tabs: \t
  • Quotes: \"
  • Backslashes: \\
  • Unicode characters by number: \uXXXX

When creating data in JSON format, the quotes to denote string values in the JSON must all be quoted. So a JSON structure:

json
{
  "user" : "ajones",  
  "group" : "admin"
}

Has to be escapeed as:

logscale
createEvents(["{\"user\" : \"ajones\",\"group\" : \"admin\"}"])