Notes Connector 25.2
Notes Connector Help

# lookup

The `lookup` method returns the value at the specified path in the JSON object.

NOTE: This method does not make a copy of the value, so modifying the returned value affects the original object.

## Syntax

    lookup( pathElements )

## Arguments

Argument | Description
--- | ---
`pathElements` | (json_path_string_or_integer) The path of the value to return. Specify one or more path elements, which might be object attribute names (strings) or array indexes (integers).

## Returns

(LuaJsonValue) Returns the value that exists at the specified path, or `nil` if the specified path does not exist.

## Example

    myJsonObject = LuaJsonObject:new()
    myJsonObject:assign( {
            attr1=LuaJsonObject:new( { n=42, x=5 } ),
            attr2=LuaJsonArray:new( 1, 2, "three" ),
        } )

    print ( myJsonObject:lookup("attr2",2):value() )
    -- three (LuaJsonArrays are zero-indexed)

    -- Modifying the returned value changes the original object
    local lookup_attr = myJsonObject:lookup("attr1"):object()
    lookup_attr:assign("y",3)
    print (myJsonObject:string())
    -- {"attr1":{"n":42,"x":5,"y":3},"attr2":[1,2,"three"]}

## See Also

- lookupByPath

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Notes Connector 25.2

Topic Title: lookup