Nice fix in Update 4 of Delphi XE2: you can now easily "import" a remote dataset obtained from a REST call. I hit this bug (in Delphi XE) about last week, and made some tests. The bug was reported by David Clegg at (it is still marked open, but it was fixed and it is in the list of the bugs fixed with Update 4). If you have a REST server simpy returning a TDataSet, on the client the proxy class will embed the JSON Table reader in a CustomSQLDataset. Provided you have a ClientDataSet connected with a DatasetProvider, you can write the following client code:

theDataSet: TDataset;
theDataSet := ClientModule1.ServerMethods1Client.GetDataSet;
DataSetProvider1.DataSet := theDataSet;

Too bad that until two days ago you might get totally messed output like this:

The problam is that the CustomSQLDataset was meant for reading from databases, in whcih the input buffer fills the enitre length of the string. However, a JSON string might as well be shorter, and previous information in the buffer remained there and became part of the output. My fix was to zero the buffer (although I "miserably" missed the first byte). Here you can see the plain Delphi XE2 version with my fix (on the left) along side with the version in Update 4 (on the right) of the Data.SqlExpr.pas unit:

Needless to say Beyond Compare is a great tool for spotting similar changes. Notice that my fix is almost identical to the one provided by Embarcadero... beside my embarassing off-by-one bug (whcih I left in anyway, and was not causing visible damage). I did it a few lines later, but that has apparently no real effect.

Again, good job with Update 4, Delphi team!

PS. Did I mention I have a session on low level dbExpress, covering these components and showing this demo, at