I am converting a TFDMemTable to JSON via SaveToStream(). Then I use TJSONObject::ParseJSONValue() to get the JSON object. After some parsing, I return the JSON in string format via ToString().
TStringStream *Stream = new TStringStream();
TJSONObject *Json = new TJSONObject();
fdMemTable->SaveToStream(Stream.get(), sfJSON);
TJSONObject *JsonParsed = (TJSONObject*) Json->ParseJSONValue(Stream->DataString);
...
return JsonParsed->ToString();
All through this, the dates remain in the form 20180329T013152 instead of 2018-03-29T01:31:52. I am looking to see if there is any option that I can set. TJsonOptions seems to be close to what I am looking for, but seems to only be used with ObjectToJsonString().
Does anyone know any such option, or do I have to do this conversion per date/time field?
There is no date/time type in JSON. Date/time values are just arbitrary string values with formatting. So, unless
TFDMemTableprovides an option to specify date/time formatting for its JSON output, then you will have to handle this on a per-field basis.BTW, you don't need to create a
TJSONObjectobject to callParseJSONValue():