jsonx-org / schema

"JSON Schema Definition" (JSD) language that offers a vocabulary to describe the structure and constraining the contents of JSON documents.
https://jsonx.org/schema/
MIT License
4 stars 1 forks source link

Support full scope of valid characters allowed in property names #10

Open safris opened 11 months ago

safris commented 11 months ago

RFC 8259 states there are no limits imposed on the value of strings used as JSON object names.

An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object SHOULD be unique.

object = begin-object [ member *( value-separator member ) ]
         end-object

member = string name-separator value

ECMA-262 explicitly states that all strings are valid object property names.

A property key value is either an ECMAScript String value or a Symbol value. All String and Symbol values, including the empty String, are valid as property keys. A property name is a property key that is a String value.

RFC 8259 lists the characters that must be escaped in JSON:

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).

ECMA-262 lists the characters that must be escaped in JavaScript:

A string literal is 0 or more Unicode code points enclosed in single or double quotes. […] All code points may appear literally in a string literal except for the closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), and U+000A (LINE FEED).