Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Filling WebClientDataSet with JSON

 Post Reply Post Reply
Author
Suer Martin View Drop Down
New Member
New Member
Avatar

Joined: 15 Jan 2014
Posts: 21
Post Options Post Options   Quote Suer Martin Quote  Post ReplyReply Direct Link To This Post Topic: Filling WebClientDataSet with JSON
    Posted: 26 Nov 2019 at 4:45pm
Hi,

is it possible somehow to fill a WebClientDataSet with a String that contains valid JSON?

e.g. sth. like this.

WebDataSet.ContentAsJSON := '[{"testfield": "WebCore"}]';

I have not found any properties like this and no methods that were able to do this. However I can use a TWebClientConnection, point it to a dummy url that exists and delivers a short answer, use the ConnectionDataReceived EventHandler and change the Response Var Parameter to my JSON String but that would be a stupid approach of course.

If sth. like that doesn't exist, it would be very helpful to have it since I am not getting all JSON from a URI. Also the other way round would be great:

someJsonStrVariable := WebDataSet.ContentAsJSON;

With this, I could use all sorts of JSON Arrays as the source for a WebClientDataset.

or LoadFromJson(AJson: String) and SaveToJson:String or similar methods/functions...

This could of course also be a specific WebClientConnection or an enhancement of the existing one.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8596
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 26 Nov 2019 at 4:57pm
If this JSON is parsed to a TJSArray, it can be assigned to WebClientDataSet.Rows
Back to Top
Suer Martin View Drop Down
New Member
New Member
Avatar

Joined: 15 Jan 2014
Posts: 21
Post Options Post Options   Quote Suer Martin Quote  Post ReplyReply Direct Link To This Post Posted: 26 Nov 2019 at 4:58pm
thx
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down