GetElementByPointer method (NotesJSONNavigator – LotusScript)

Retrieves a NotesJSONElement using JSON Pointer syntax to identify the element.

Defined in

NotesJSONNavigator

Syntax

Set el = jsnav.GetElementByPointer(pointer)

Parameters

pointer

String. A JSON Pointer string that identifies the desired element.

[SuppressErrors]
Boolean. Optional. If True, suppress “JSON Element not found error” and return Null element when element not found.
Note: This parameter is new with release 14.5.1.

Return value

Returns NotesJSONElement that corresponds to the JSON pointer. If pointer is empty string, return whole document in JSONNavigator.

Example

The following code returns an element with name test and value "A string".
Dim jsnav As NotesJSONNavigator 
Set jsnav = session.CreateJSONNavigator(|{"test":"A string"}|) 
Set el = jsnav.GetElementByPointer("/test")
The following code with suppress error “Element not found” when no element found
Dim jsnav As NotesJSONNavigator 
Set jsnav = session.CreateJSONNavigator(|{"test":"A string"}|) 
Set el = jsnav.Getelementbypointer("/test1", True)
If el Is Nothing Then
	MessageBox("Elemenet not found")
End If
The following return whole document to element when pass in pointer as empty string.
Dim session As New NotesSession
Dim jsnav As NotesJSONNavigator
Dim el As NotesJSONElement
Dim subel As NotesJSONElement
	
Set jsnav = session.CreateJSONNavigator(|{"test1":"A string 1", "test2":"A String2"}|) 
Set el = jsnav.GetElementByPointer("") 'Element value now {"test1":"A string 1", "test2":"A String2"}
	
Set subel = el.value.GetFirstElement() 
while Not (subel is Nothing)
	MessageBox(subel.value)
	Set subel = el.value.GetNextElement()
Wend