Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JsonPointer

Implementation of RFC6901 Json Pointers.

Hierarchy

  • JsonPointer

Index

Methods

append

  • Append an unescaped token to this pointer
    Note: If you provide escaped path the behaviour is undefined

    Parameters

    • token: string

    Returns JsonPointer

  • Append the index as reference token to JsonPointer

    Parameters

    • index: number

    Returns JsonPointer

  • Append an unescaped list of tokens to JsonPointer
    Note: If you provide escaped paths the behaviour is undefined

    Parameters

    • tokens: string

    Returns JsonPointer

  • Append all tokens of pointer to this pointer
    Note: The base URI of this pointer will remain untouched

    Parameters

    Returns JsonPointer

copy

  • Copy a JsonPointer

    Returns JsonPointer

getURIWithoutFragment

  • getURIWithoutFragment(): any
  • Return the underlying URI without the fragment

    Returns any

isLocalPointer

  • isLocalPointer(): boolean
  • Return true if the pointer is local (URI with only fragment)

    Returns boolean

isParent

  • Return true if this pointer is a parent pointer of child.
    For instance "/properties" pointer is parent pointer of "/properties/parent"

    Parameters

    Returns boolean

isRootPointer

  • isRootPointer(): boolean
  • Return true if the pointer is a root pointer

    Returns boolean

parent

  • Remove last reference token of this pointer

    Returns JsonPointer

query

  • Query objectToQuery using the provided JsonPointerIterator.
    If you need to query Vert.x json data structures, use {@link JsonPointer#queryJson}
    Note: if this pointer is a root pointer, this function returns the provided object

    Parameters

    Returns any | null

queryJson

  • queryJson(jsonElement: any): any | null
  • Query jsonElement.
    Note: if this pointer is a root pointer, this function returns the provided json element

    Parameters

    • jsonElement: any

    Returns any | null

queryJsonOrDefault

  • queryJsonOrDefault(jsonElement: any, defaultValue: any): any | null
  • Query jsonElement. If the query result is null, returns the default.
    Note: if this pointer is a root pointer, this function returns the provided object

    Parameters

    • jsonElement: any
    • defaultValue: any

    Returns any | null

queryOrDefault

  • Query objectToQuery using the provided JsonPointerIterator. If the query result is null, returns the default.
    If you need to query Vert.x json data structures, use {@link JsonPointer#queryJsonOrDefault}
    Note: if this pointer is a root pointer, this function returns the provided object

    Parameters

    Returns any

toString

  • toString(): string
  • Build a string representation of the JSON Pointer

    Returns string

toURI

  • toURI(): any
  • Build a URI representation of the JSON Pointer

    Returns any

tracedQuery

  • Query objectToQuery tracing each element walked during the query, including the first and the result (if any).
    The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered

    Parameters

    Returns any

write

  • write(objectToWrite: any, iterator: JsonPointerIterator, newElement: any, createOnMissing: boolean): any
  • Write newElement in objectToWrite using this pointer. The path token "-" is handled as append to end of array
    If you need to write in Vert.x json data structures, use {@link JsonPointer#writeJson} (Object)}

    Parameters

    Returns any

writeJson

  • writeJson(jsonElement: any, newElement: any): any
  • writeJson(jsonElement: any, newElement: any, createOnMissing: boolean): any
  • Write newElement in jsonElement using this pointer. The path token "-" is handled as append to end of array.

    Parameters

    • jsonElement: any
    • newElement: any

    Returns any

  • Write newElement in jsonElement using this pointer. The path token "-" is handled as append to end of array.

    Parameters

    • jsonElement: any
    • newElement: any
    • createOnMissing: boolean

    Returns any

Static create

  • Build an empty JsonPointer

    Returns JsonPointer

Static from

  • Build a JsonPointer from a json pointer string

    Parameters

    • pointer: string

    Returns JsonPointer

Static fromURI

  • Build a JsonPointer from a URI.

    Parameters

    • uri: any

    Returns JsonPointer

Generated using TypeDoc