Passa al contenuto principale

5. JSON String Representation (Rappresentazione di stringa JSON)

5. JSON String Representation (Rappresentazione di stringa JSON)

Un JSON Pointer può essere rappresentato in un valore di stringa JSON. Secondo [RFC4627], Section 2.5, tutte le istanze di virgolette '"' (%x22), barra inversa '' (%x5C) e caratteri di controllo (%x00-1F) DEVONO essere escapate.

Si noti che prima di elaborare una stringa JSON come JSON Pointer, le sequenze di escape con barra inversa devono essere de-escapate (unescaped).

Ad esempio, dato il seguente documento JSON:

{
"foo": ["bar", "baz"],
"": 0,
"a/b": 1,
"c%d": 2,
"e^f": 3,
"g|h": 4,
"i\\j": 5,
"k\"l": 6,
" ": 7,
"m~n": 8
}

Le seguenti stringhe JSON vengono valutate ai valori corrispondenti:

""           // the whole document
"/foo" ["bar", "baz"]
"/foo/0" "bar"
"/" 0
"/a~1b" 1
"/c%d" 2
"/e^f" 3
"/g|h" 4
"/i\\j" 5
"/k\"l" 6
"/ " 7
"/m~0n" 8