Amazon S3 Connector 25.2
Amazon S3 Connector Help

# lookup

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

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

## 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

The following example demonstrates how to obtain a value:

    local myJsonObject = LuaJsonObject:new( { product="IDOL" , version=11 } )
    local myJsonArray = LuaJsonArray:new(0, 1, 2, myJsonObject)
    local myValue = myJsonArray:lookup(3, "product")
    print (myValue:value())
    -- IDOL

The following example demonstrates how modifying a returned value affects the original array:

    local myJsonObject = LuaJsonObject:new()
    myJsonObject:assign("name", LuaJsonArray:new("value1"))

    local myJsonArray = myJsonObject:lookup("name"):array()
    myJsonArray:append("value2")

    print (myJsonObject:string())
    -- {"name":["value1","value2"]}

## 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 Amazon S3 Connector 25.2

Topic Title: lookup