You are not logged in.
Pages: 1
Hi,
In mormot2, how to read the json value and assign to record?
type
TMyValue = packed record
values: variant;
end
TMyValues = array of TMyValue;
const JsonValues = '[{"values":[1,2,3]}]';
var
MyVal: TMyValues;
DynArr: TDynArray;
begin
DynArr.Init(TypeInfo(TMyValues), MyVal);
DynArr.LoadFromJSON(PUTF8(JsonValues);
end;
After above function, MyVal is null.
How to load the jason array to variant field?
Last edited by bigheart (2022-12-09 07:46:18)
Offline
You can use TDocVariantData
Offline
The JsonData is from outside.
So i have to use dynamic array.
You mean that array of double from json value can be stored in the record variant field using TDocVariantData?
Last edited by bigheart (2022-12-09 08:24:44)
Offline
you can use that example:
var doc:TDocVariantData;
doc := TDocVariantData(_Json(jsonDataString));
Offline
Could you give me advise any other way to json array value to set record variant field?
Offline
Pages: 1