Delphi-Quellcode:
/// <summary> Parses a JSON path with names and indexes.</summary>
/// <remarks>
/// The syntax to write paths is similar to XPath but in a Json way.
/// The following XPath expression:
/// /entities/urls[0]/indices[1]
/// would look like
/// entities.urls[0].indices[1] (dot notation)
/// or
/// entities["urls"][0]["indices"][1] (bracket notation)
///
/// The dot (.) token is used to access the object elements:
/// ex: object.key
///
/// The bracket ([]) token is used to access array or object elements:
/// In array: cities[0]
/// In object: city["name"] or city['name']
/// In object: ["city"]["name"] or ['city']['name']
///
/// The quote (" or ') is used to introduce a literal when the element is being written in bracket notation:
/// ex:["first"]["second"] or ['first']['second']
///
/// To escape the quote in a literal use backslash (\): \"
/// ex: ["quotes(\").should.be.escaped"] or ['quotes(\').should.be.escaped']
///
/// Note: The backslash will only escape quotes within a literal. Bracket notation can be useful when
/// names can not be written in dot notation, like the objects keys with dot characters:
/// ex: object["key.with.dots"] or object['key.with.dots']
///
/// </remarks>
TJSONPathParser =
record
Zitat:
Note: The backslash will only escape quotes within a literal. Bracket notation can be useful when
names can not be written in dot notation, like the objects keys with dot characters:
ex: object["key.with.dots"] or object['key.with.dots']