Metreeca MIME
    Preparing search index...

    Type Alias JPath

    JPath: (path: string) => readonly Value[]

    JSONPath-like selector over JSON values.

    Selects nested values from a set of target JSON values, using a JSONPath-like syntax. The target set is fixed when the selector is created.

    Type Declaration

      • (path: string): readonly Value[]
      • Selects values.

        Each selection spans the whole target set: the values selected from each target are merged into a single list.

        A path is a sequence of steps, each selecting from the values selected by the previous one. Steps are written one after the other, separated only by the leading . of the steps that carry one:

        • $ — the target value itself; allowed only as the leading step, where it may be omitted
        • .property / property — object property
        • ['property'] — object property, with lenient JSON string escapes: an unknown escape stands for the character it introduces, so \' names an apostrophe
        • [0] — array element by index
        • .* / [*] — every element of an array or every property value of an object

        Property steps don't reach into arrays: selecting the properties of objects inside an array requires an explicit [*] or .* step.

        Only JSON values are selected: null is selected like any other value, while undefined (which can only occur in values built in code) is skipped like an absent property.

        Parameters

        • path: string

          The selection path; an empty path or $ selects the target values unchanged

        Returns readonly Value[]

        An immutable list of the values selected by path, ordered by target and, within each target, in document order; empty if path selects no value

        SyntaxError If path is malformed