#1 2015-06-19 19:29:34

igors233
Member
Registered: 2012-09-10
Posts: 241

Loading/Saving records to compact json

Hi,

I'm executing some queries on the server side and storing data in json format, Execute(SqlTxt, []).FetchAllAsJSON(False), so it's saved in not expanded format. Then I'm transferring that data to client and I would like to load it in dynamic records with DynArrayLoadJson.
However, I don't get any results in records after that, and if I use FetchAllAsJSON(True) (in expanded format) I can load the records normally on the client.
Can you tell me is it possible (and how) to load records in compact (not expanded format) with DynArrayLoadJson? Or alternatively how to save them on server side in more compact format (in smaller size)?

Thanks,
Igor

Offline

#2 2015-06-20 06:53:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Loading/Saving records to compact json

The easiest is to use a TSQLTableJSON instance: read the not expanded format with it, then call GetJSONValues(true) to retrieve back the expanded layout, ready to be unserialized by DynArrayLoadJson.

If you what even smaller content of a SQL result, you may try with the SynDB binary format.
Create the content with TSQLDBStatement.FetchAllToBinary, then use TSQLDBProxyStatementRandomAccess to read the information back, using FetchAllAsJSON() + DynArrayLoadJson() to fill your dynamic array.
But in won't work with cross-platform clients, whereas the "not expanded" JSON format would be supported by our cross-platform JSON clients.

Offline

Board footer

Powered by FluxBB