MongoDB Connector 12.12

# LuaJsonObject:new

The constructor for a `LuaJsonObject` object (creates a new `LuaJsonObject`).

If you do not specify any attributes to assign to the object (by omitting the `attributes` argument), an empty object is created.

## Syntax

    LuaJsonObject:new( [attributes] )

## Arguments

Argument | Description
--- | ---
`attributes` | (lua_json_object_type) A table of attributes (name/value pairs) to assign to the object. The keys in the table must be strings which specify the names of the attributes. Each value can be a Boolean, float, integer, string, LuaJsonObject, LuaJsonArray, 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: `LuaJsonObject:new( { key=LuaJsonValue:new(nil) } )`.

## Returns

(LuaJsonObject). The new `LuaJsonObject` object.

## Example

The following is a simple JSON object:

    {"product":"IDOL","version":11}

To create a `LuaJsonObject` object to represent this JSON object:

    local myJsonObject = LuaJsonObject:new( { product="IDOL" , version=11 } )

© 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 MongoDB Connector 12.12

Topic Title: LuaJsonObject:new