You are not logged in.
Pages: 1
Following this post. Why does JSON have extra square bracket in the output?
{"result":[[1,2,3,4,"1001","1999"],[2,3,4,5,"1002","1998"],[3,4,5,6,"1003","1997"]]]}
AFP.Init(TypeInfo(TFVs),AF);
for i := 0 to 3 do begin
F.Major := i;
F.Minor := i+1;
F.Release := i+2;
F.Build := i+3;
F.Main := IntToString(i+1000);
F.Detailed := IntToString(2000-i);
AFP.Add(F);
end;
test := AFP.SaveToJSON;
result := RecordLoadJSON(F, pointer(test),TypeInfo(TFV));
Offline
huumm...
result := AFP.SaveToJSON(true);
it returns the correct output:
{"result":[[[0,1,2,3,"1000","2000"],[1,2,3,4,"1001","1999"],[2,3,4,5,"1002","1998"],[3,4,5,6,"1003","1997"]]]}
and...
result := RecordLoadJSON(F, pointer(test),TypeInfo(TFV));
it returns an extra square bracket.
{"result":[[1,2,3,4,"1001","1999"],[2,3,4,5,"1002","1998"],[3,4,5,6,"1003","1997"]]]}
The custom reader method return an extra ']' for last item of array, and you'll get a Unexpected token ]
Offline
Pages: 1