REST.Json.TJson.ObjectToJsonString
Delphi
class function ObjectToJsonString(AObject: TObject; AOptions: TJsonOptions = [joDateIsUTC, joDateFormatISO8601]): string;
C++
__classmethod System::UnicodeString __fastcall ObjectToJsonString(System::TObject* AObject, TJsonOptions AOptions = (TJsonOptions() << TJsonOption::joDateIsUTC << TJsonOption::joDateFormatISO8601 ));
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | REST.Json.pas REST.Json.hpp |
REST.Json | TJson |
Description
Returns a JSON string that represents the specified TObject descendant.
JSON Options
ObjectToJsonString accepts an optional set of options, AJsonOptions
, that determines how ObjectToJsonString interprets the data of AObject
and renders that data in the resulting JSON string.
The table below describes all the available JSON options that you may specify. ObjectToJsonString uses joDateIsUTC
and joDateFormatISO8601
if you do not specify a custom value for AJsonOptions
.
Option | Description |
---|---|
|
Formats dates using the ISO 8601 standard. For example: |
|
Formats dates as MongoDB Extended JSON. For example: |
|
Formats dates as Unix time. For example: |
|
Times in If you do not specify this option, ObjectToJsonString assumes that times in |
|
Does not include key-value pairs of JSON objects when the value of a pair would be an empty JSON array. For example, if |
|
Does not include key-value pairs of JSON objects when the value of a pair is an empty string. For example, if |