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

# TJSONArray.Insert

Insert an element in the array.

## Declaration

Source position: fpjson.pp line 560

`public procedure TJSONArray.Insert(`
`Index: Integer`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`Item: TJSONData`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`I: Integer`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`I: Int64`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`I: QWord`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`const S: UnicodeString`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`const S: string`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`F: TJSONFloat`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`B: Boolean`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`AnArray: TJSONArray`
`); procedure TJSONArray.Insert(`
`Index: Integer;`
`AnObject: TJSONObject`
`);`

## Arguments

`Index` |  | Position at which to insert the new value

## Arguments

`Index` |  | Position at which to insert the new value
`Item` |  | JSON Data object to insert.

## Arguments

`Index` |  | Position at which to insert the new value
`I` |  | Integer value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`I` |  | Integer value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`I` |  | Integer value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`S` |  | String value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`S` |  | String value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`F` |  | Floating point value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`B` |  | Boolean value to insert

## Arguments

`Index` |  | Position at which to insert the new value
`AnArray` |  | JSON array to insert.

## Arguments

`Index` |  | Position at which to insert the new value
`AnObject` |  | JSON Object to insert

## Description

Insert adds a value or element to the array at position Index. Elements with index equal to or larger than Index are shifted. Like Add, it converts plain pascal values to JSON values.

Note that when inserting a TJSONData instance to the array, it is owned by the array. Index must be a value between 0 and Count-1.

## Errors

If an invalid index is specified, an exception is raised.

## See also

Add |  | Add a JSON value to the array
Delete |  | Delete an element from the list by index
Extract |  | Extract an element from the array
Clear |  | Clear the array

Documentation generated on: May 14 2021