vnx.Object

Object represents an arbitrary object which is dynamically created and does not have a type. However an optional type name can be specified via a special field called __type. Internally it is a map of string keys to vnx.Variant values.

JSON

In JSON format an object is specified as follows:

{
        "__type": "optional.type.name.here",
        "field": "value",
        "some": 1234,
        "array": [1, 2, 3, 4],
        "nested": {
                "example": "value",
                ...
        },
        ...
}

Lua Script

In Lua Script an object can be created as follows:

{
                field = "value",
                some = 1234,
                array = {1, 2, 3, 4},
                nested = {
                        example = "value",
                        ...
                },
                ...
}

Native C++

In native C++ an object can be created as follows:

#include <vnx/vnx.h>

vnx::Object obj;
obj["field"] = "value";
obj["some"] = 1234;
obj["array"] = std::vector<int>{1, 2, 3, 4};

vnx::Object nested;
nested["example"] = "value";
obj["nested"] = nested;

std::cout << obj << std::endl;