I'm trying to pass a JSON to a TClientDataSet using the following function:
procedure JsonToDataset(aDataset : TDataSet; aJSON : string);
var
JObj: TJSONObject;
JArr: TJSONArray;
vConv : TCustomJSONDataSetAdapter;
i: Integer;
begin
if (aJSON = EmptyStr) then
begin
Exit;
end;
JArr := nil;
JObj := nil;
try
JArr := TJSONObject.ParseJSONValue(aJSON) as TJSONArray;
except
JObj := TJSONObject.ParseJSONValue(aJSON) as TJSONObject;
end;
vConv := TCustomJSONDataSetAdapter.Create(Nil);
try
vConv.Dataset := aDataset;
if JObj <> nil then
vConv.UpdateDataSet(JObj)
else
vConv.UpdateDataSet(JArr);
finally
vConv.Free;
JObj.Free;
end;
end;
However, when I have a large field, the function truncates my string to 255 characters. JSON Example:
{
"string": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur rhoncus convallis risus, nec posuere nisl gravida vitae. Duis elementum augue nec condimentum rutrum. Aliquam sodales, dolor at laoreet pharetra, tortor eros efficitur eros, vel euismod sem nulla quis erat. Aliquam erat volutpat. Ut vitae congue lectus, et sodales velit. Cras suscipit pulvinar dolor ut consequat. Praesent eget pellentesque justo. In at maximus lectus, posuere mattis felis."
}
Is there any way around this?