[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'fpjson' (#fcl)

# TJSONData

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base (abstract) object for all JSON based data types

## Declaration

Source position: fpjson.pp line 108

`type TJSONData = class(TObject)`
`public`
`class function JSONType; virtual;` |  | The native JSON data type represented by this object
`property CompressedJSON: Boolean; [rw]` |  | Compress JSON - skip whitespace
`constructor Create; virtual;` |  | Create a new instance of TJSONData.
`procedure Clear; virtual; abstract;` |  | Clear the raw value of this data object
`procedure DumpJSON();` |  | Fast, memory efficient dump of JSON in stream
`function GetEnumerator; virtual;` |  | Return an enumerator for the data
`function FindPath();` |  | Find data by name
`function GetPath();` |  | Get data by name
`function Clone; virtual; abstract;` |  | Duplicate the value of the JSON data
`function FormatJSON();` |  | Return a formatted JSON representation of the data.
`property Count: Integer; [r]` |  | Number of sub-items for this data element
`property Items []: TJSONData; [rw]` |  | Indexed access to sub-items
`property Value: TJSONVariant; [rw]` |  | The value of this data object as a variant.
`property AsString: TJSONStringType; [rw]` |  | Access the raw JSON value as a string
`property AsUnicodeString: TJSONUnicodeStringType; [rw]` |  | Return the value as a Unicode string
`property AsInt64: Int64; [rw]` |  | Access the raw JSON value as an 64-bit integer
`property AsQWord: QWord; [rw]` |  | Access the raw JSON value as an 64-bit unsigned integer
`property AsLargeInt: TJSONLargeInt; [rw]` |  | Access to data as largeint
`property AsFloat: TJSONFloat; [rw]` |  | Access the raw JSON value as a float
`property AsInteger: Integer; [rw]` |  | Access the raw JSON value as an 32-bit integer
`property AsBoolean: Boolean; [rw]` |  | Access the raw JSON value as a boolean
`property IsNull: Boolean; [r]` |  | Is the data a null value ?
`property AsJSON: TJSONStringType; [r]` |  | Return a JSON representation of the value
`end;`

## Inheritance

`TJSONData` |  | Base (abstract) object for all JSON based data types
`TObject`

## Description

TJSONData is an abstract class which introduces all properties and methods needed to work with JSON-based data. It should never be instantiated. Based on the type of data that must be represented one of the following descendents must be instantiated instead.

Numbers
  must be represented using one of TJSONIntegerNumber, TJSONFloatNumber or TJSONInt64Number, depending on the type of the number.
Strings
  can be represented with TJSONString.
Boolean
  can be represented with TJSONBoolean.
null
  is supported using TJSONNull
Array
  data can be represented using TJSONArray
Object
  data can be supported using TJSONObject

## See also

TJSONIntegerNumber |  | Class to represent 32-bit integer JSON data.
TJSONString |  | Class to represent string JSON data.
TJSONBoolean |  | Class to represent boolean JSON data.
TJSONNull |  | Class to represent boolean JSON data.
TJSONArray |  | Class of TJSONArray
TJSONObject |  | Class of TJSONObject

Documentation generated on: May 14 2021