RDP1974 40 Posted August 25, 2021 hello, can someone has a function that pass a JSON array string -> to a -> Firedac TFDMemTable thanks Share this post Link to post
RDP1974 40 Posted August 25, 2021 I have found this https://github.com/viniciussanchez/dataset-serialize Share this post Link to post
RDP1974 40 Posted August 25, 2021 var LField: TField; begin mtEmpty.LoadFromJSON(memoEmpty.Lines.Text); for LField in mtEmpty.Fields do mmDataType.Lines.Add(Format('Field: %s - %s', [LField.FieldName, GetEnumName(System.TypeInfo(TFieldType), Ord(LField.DataType))])); this is enough, calling LoadFromJSON directly from firedac table however (webbroker post) if I load from Request.ContentFields.Text (posting raw json) I get a general error if I load from Request.ContentFields.Values['mandatory'] it's working then some minor trouble re-serializing with JsonSuperObject with characters unicode utf8, etc. I'll take a look Share this post Link to post
RDP1974 40 Posted August 25, 2021 ah Webbroker calling Request.Content (example for POST body) is applying encoding/decoding text but there is a method to access the raw content as TBytes I found webbroker classes to be excellent Share this post Link to post
corneliusdavid 214 Posted August 26, 2021 You want to copy from the Request to a table? Wouldn't load the Request, call a web service, then copy from the Response to the table? I'm not completely sure what you're doing but I've been working with REST services in Delphi 10.4 and find that hooking up a TRESTResponseDataSetAdapter to both the TRESTResponse and a TFDMemTable does all the work of parsing a JSON response string into a memory table for me--no code! Share this post Link to post