Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: TFDJSONInterceptor DataSetsToJSONObject How to read result without RadStud


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0 Threads: [ Previous | Next ]
Gaetano Mantovani

Posts: 19
Registered: 8/30/14
TFDJSONInterceptor DataSetsToJSONObject How to read result without RadStud  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2017 2:55 AM
Hello,
I'm writing a rest datasnap server with some methods that return a JSon Dataset.
In the methods I have a code similar as the below:
TJSONObject* TServerMethods1::RetrieveData(parameters)
{

MyFDQuery->Close();
MyFDQuery->SQL ..
MyFDQuery->Open();
..

TFDJSONDataSets *ds = new TFDJSONDataSets();
TFDJSONDataSetsWriter::ListAdd(ds, MyFDQuery);
TFDJSONInterceptor::DataSetsToJSONObject(ds, obj);
return obj;
}

And in the client I have a code like the below:

foo
{

TJSONObject * LJSONObject (ClientModule1->ServerMethods1Client->RetrieveData(parameters));
std::auto_ptr<TFDJSONDataSets>LDataSets(new TFDJSONDataSets());
TFDJSONInterceptor::JSONObjectToDataSets(LJSONObject, LDataSets.get());

TFDAdaptedDataSet * LDataSet = TFDJSONDataSetsReader::GetListValue(LDataSets.get(), 0);
MemTable->AppendData(*LDataSet);

}

All work fine, now I need to read the dataset without using c++builder/delphi, I tried with Html5builder but seems have problems with the SSL connection.
Anyway I need to read the dataset with PHP/Javascript.
When the method is called using a classic rest call (I used the methods invoker with a web-browser) the page get a result similar as the below:

{"xy":"eJy9mm9sG2cZwB\/nj5s6f+pmWZctbfZuXVjCGsd2uzYtIPViX7JbHdvzXbIMPtCrc2mtOT7PcUqH\r\n..."}

There is a way to decode the above without radstudio tools?
I wouldn't create new methods that give the recordset in 'pure' json, if is possible.

Thank you for the answers.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02