Salesforce Connector 12.12

# assign

The `assign` method adds a table of attributes (name/value pairs) to the object.

## Syntax

    assign (attributes)

## Arguments

Argument | Description
--- | ---
`attributes` | (lua_json_object_type) The table of attributes to add. The keys in the table must be strings which specify the names of the attributes to add. Each value can be a Boolean, float, integer, string, LuaJsonArray, LuaJsonObject, LuaJsonValue, or nil. TIP: In Lua, keys in a table cannot be assigned the value of `nil`. If you want to have a null value (`nil` in Lua), you can do the following: `myJsonObject:assign( { key=LuaJsonValue:new(nil) } )`.

## Example

    local myJsonObject = LuaJsonObject:new()
    myJsonObject:assign( {
            attr1=LuaJsonObject:new( { n=42 } ),
            attr2=LuaJsonArray:new( 1, 2, "three" ),
            attr3=true
        } )
    print(myJsonObject:string())
    -- {"attr1":{"n":42},"attr2":[1,2,"three"],"attr3":true}

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Salesforce Connector 12.12

Topic Title: assign