5 Data encoding ToC Previous Next

5.4 OPC UA JSON ToC Previous Next

5.4.6 Structures ToC Previous Next

Structures shall be encoded as JSON objects.

If the value of a field is NULL it shall be omitted from the encoding.

For example, instances of the structures:

struct Type2
{
Int32 A;
Int32 B;
Char* C;
};

struct Type1
{
Int32 X;
Int32 NoOfY;
Type2* Y;
Int32 Z;
};

Are represented in JSON as:

{
"X":1234,
"Y":[ { "A":1, "B":2, "C":"Hello" }, { "A":3, "B":4 } ],
"Z":5678
}

Where ā€œCā€ is omitted from the second Type2 instance because it has a NULL value.

Previous Next