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

# TJSONObject.Add

Add a name, value to the object

## Declaration

Source position: fpjson.pp line 716

`public function TJSONObject.Add(`
`const AName: TJSONStringType;`
`AValue: TJSONData`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`AValue: Boolean`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`AValue: TJSONFloat`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`const AValue: TJSONStringType`
`):Integer; overload; function TJSONObject.Add(`
`const AName: string;`
`AValue: TJSONUnicodeStringType`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`Avalue: Int64`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`Avalue: QWord`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`Avalue: Integer`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType`
`):Integer; overload; function TJSONObject.Add(`
`const AName: TJSONStringType;`
`AValue: TJSONArray`
`):Integer; overload;`

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Function result

The resulting TJSONData descendent

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`Avalue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`Avalue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.
`Avalue` |  | Value to add to the object.

## Arguments

`AName` |  | Name to add the value with.

## Arguments

`AName` |  | Name to add the value with.
`AValue` |  | Value to add to the object.

## Description

Add adds the value AValue with name AName to the object. If the value is not a TJSONData descendent, then it is converted to a TJSONData value, and it returns the TJSONData descendent that was created to add the value.

The properties Integers, Int64s, Booleans, Strings, Floats, Arrays and Objects will not raise an exception if an existing name is used. They will overwrite any existing value.

## Errors

If a value with the same name already exists, an exception is raised.

## See also

Integers |  | Named access to integer values
Int64s |  | Named access to int64 values
Booleans |  | Named access to boolean values
Strings |  | Named access to string values
Floats |  | Named access to float values
Arrays |  | Named access to JSON array values
Objects |  | Named access to JSON object values

Documentation generated on: May 14 2021