Consider the following Json data:
The array elements are lists of integers, strings and objects.
{
"message": [
[ 0, "a text" ],
[ 1 ],
[ 1, { "switch": true } ],
[ 2, "text one", "text line two" ]
]
}
Assume the JsonData const below is filled with the Json above. Using the Json tools from unit REST.Json, I would typically do like this.
const
JsonData = // see Json data above
var
Message: TJsonMessage;
begin
Message := TJson.JsonToObject<TJsonMessage>(JsonData);
But - how should TMessageArray be declared to accept the above structure? Is it actually possible?
TJsonMessage = class
private
Fmessage: TMessageArray;
public
property message: TMessageArray read FMessage write FMessage;
end;