If I have a TRESTResponseDataSetAdapter
with RootElement = 'testdata'
and provide it with the following JSON, it adds a row to the connected dataset.
RESTResponseDataSetAdapter1.ResponseJSON := TRESTResponseJSON.Create(
Form1,
TJSONObject.ParseJSONValue('{"testdata":[]}'),
true
);
If I provide some data in the array, I get the expected rows in the dataset, but if the array is empty I get a row with what appears to be all null values.
It seems that the only way to get an empty dataset is to provide something invalid, like {"testdata":[,]}
for example. That gives me an empty dataset without generating any errors.
Is this the expected behaviour? If not, what could be the issue here? I've tried changing the TypesMode
but I get the same result no matter which setting it is.
The dataset I'm using is a TdxMemData
from DevExpress
. I recently upgraded from Delphi 10.2 to Delphi 10.4. Things were working fine on 10.2 (i.e. if the JSON array was empty, the dataset would also be empty), so it seems that something has changed in 10.3 or 10.4.