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 } )

_HP_HTML5_bannerTitle.htm