This string is part a JSON object/file:
"Mask" : "{0}(CASE WHEN {1} = {2} THEN {3} ELSE 0 END) {4}"
Will JSON recognize that as part of standard JSON notation or do I need to escape those curly braces s somehow?
If so, how does one escape curly braces in JSON?
In JSON the only characters you must escape are \, ", and control codes. Thus in order to escape your structure, you'll need a JSON specific function. As you might know, all of the escapes can be written as \uXXXX where XXXX is the UTF-16 code unit¹ for that character.
Google Sheets as JSON data source for JavaScriptCurly braces hold objects and each name is followed by ':'(colon), the name/value pairs are separated by , (comma). Square brackets hold arrays and values are separated by ,(comma).
From what I can read on json.org, all JSON strings should start with { (curly brace), and [ characters (square brackets) represent an array element in JSON.
JSON (JavaScript Object Notation) This makes JSON human-readable. JSON is easier to parse than XML. This is because JSON uses a fixed set of delimiters. These delimiters include curly braces ({ }), commas (,), colons (:) and square brackets ([]).
No. Curly braces do not have to be escaped in JSON.
No, curly braces do not have to be escaped in JSON strings.
JSON is defined in RFC 7159. The Section 7: Strings lists the string characters that must be escaped:
All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).
While all characters can be escaped, curly braces do not have to be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With