---
product: Chilkat
product_version: 11.7.0
language: powerbuilder
language_label: PowerBuilder
class: JsonArray
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/powerbuilder_JsonArrayRef.html
---
# Chilkat JsonArray — PowerBuilder — v11.7.0

> Chilkat 11.7.0 · language=powerbuilder · class=JsonArray
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/JsonArray.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/guide.md`.

## Purpose

**Read, modify, search, and emit ordered JSON arrays.**

`Chilkat.JsonArray` is the JSON array companion to `Chilkat.JsonObject`. It represents an ordered list of JSON values and provides index-based methods for reading, inserting, replacing, deleting, swapping, searching, and emitting array data. It supports scalar values, nested objects, nested arrays, date/time parsing, exact numeric string handling, compact or pretty output, and search helpers for arrays of strings or arrays of objects.

**Ordered JSON values**

Work with JSON arrays as ordered lists containing strings, numbers, booleans, nulls, objects, arrays, and mixed value types.

**Index-based access**

Retrieve, insert, replace, delete, or swap values by array index when processing JSON list data.

**Nested objects and arrays**

Access child `JsonObject` and `JsonArray` values to navigate and modify deeper JSON structures.

**Search helpers**

Search arrays of strings or arrays of objects to locate matching values without manually scanning every element.

**Date and numeric handling**

Parse date/time values and preserve exact numeric strings when JSON data contains values that must not be rounded or reformatted.

**Emit JSON output**

Produce compact or pretty JSON output after array data has been loaded, edited, searched, or built programmatically.

**Common pattern:** Use `JsonObject` to navigate named members and JSON paths, then use `JsonArray` to iterate or modify ordered lists found within the object tree. Retrieve nested objects or arrays as needed, update values by index, and emit the final JSON in compact or pretty form.

For an extended overview, see [JsonArray Class Overview](https://www.chilkatsoft.com/jsonarray_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```powerbuilder
oleobject loo_JsonArray
integer li_rc

loo_JsonArray = create oleobject
li_rc = loo_JsonArray.ConnectToNewObject("Chilkat.JsonArray")
if li_rc < 0 then
    destroy loo_JsonArray
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// ... use loo_JsonArray ...

destroy loo_JsonArray
```

PowerBuilder uses the Chilkat ActiveX through an `oleobject`: declare the variable, `create` it, connect it to the Chilkat class with `ConnectToNewObject`, and `destroy` it when finished. A negative return code from `ConnectToNewObject` means the ActiveX is not registered, or the registered ActiveX does not match the bitness (32-bit or 64-bit) of the PowerBuilder target.

Objects returned by methods (such as an `HttpResponse` or `JsonObject`) are also `oleobject` variables and must likewise be destroyed. A method that fails to return an object returns `null`; test with `IsNull()`. In the signatures on this page, the Chilkat class name identifies which object is expected or returned; the PowerBuilder variable type is always `oleobject`.

To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `ConnectToNewObject("Chilkat.JsonArray.11")` for Chilkat v11.\*.\*.

Members typed `blob` exchange binary data as a Variant byte array. The PowerBuilder examples instead use the `BinData`-based alternatives (methods ending in *Bd*), which keep binary data inside Chilkat objects.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in PowerBuilder.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `string DebugLogFilePath` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastBinaryResult` | `blob LastBinaryResult (read-only)` | read-only | This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. |
| `LastErrorHtml` | `string LastErrorHtml (read-only)` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `string LastErrorText (read-only)` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `string LastErrorXml (read-only)` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `long LastMethodSuccess` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `LastStringResult` | `string LastStringResult (read-only)` | read-only | In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. |
| `LastStringResultLen` | `long LastStringResultLen (read-only)` | read-only | The length, in characters, of the string contained in the LastStringResult property. |
| `VerboseLogging` | `long VerboseLogging` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `string Version (read-only)` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `EmitCompact` | property, read/write | `long EmitCompact` |
| `EmitCrlf` | property, read/write | `long EmitCrlf` |
| `FindStartIndex` | property, read/write | `long FindStartIndex` |
| `Size` | property, read-only | `long Size (read-only)` |
| `AddArrayAt` | method | `long AddArrayAt(long index)` |
| `AddArrayAt2` | method | `long AddArrayAt2(long index, ChilkatJsonArray jarr)` |
| `AddBoolAt` | method | `long AddBoolAt(long index, long value)` |
| `AddIntAt` | method | `long AddIntAt(long index, long value)` |
| `AddNullAt` | method | `long AddNullAt(long index)` |
| `AddNumberAt` | method | `long AddNumberAt(long index, string numericStr)` |
| `AddObjectAt` | method | `long AddObjectAt(long index)` |
| `AddObjectAt2` | method | `long AddObjectAt2(long index, ChilkatJsonObject json)` |
| `AddObjectCopyAt` | method | `long AddObjectCopyAt(long index, ChilkatJsonObject jsonObj)` |
| `AddStringAt` | method | `long AddStringAt(long index, string value)` |
| `AddUIntAt` | method | `long AddUIntAt(long index, long value)` |
| `AppendArrayItems` | method | `long AppendArrayItems(ChilkatJsonArray jarr)` |
| `ArrayAt` | method | `ChilkatJsonArray ArrayAt(long index)` |
| `ArrayAt2` | method | `long ArrayAt2(long index, ChilkatJsonArray jarr)` |
| `BoolAt` | method | `long BoolAt(long index)` |
| `Clear` | method | `Clear()` |
| `DateAt` | method | `long DateAt(long index, CkDateTime dt)` |
| `DeleteAt` | method | `long DeleteAt(long index)` |
| `DtAt` | method | `long DtAt(long index, long bLocal, DtObj dt)` |
| `Emit` | method | `string Emit()` |
| `EmitSb` | method | `long EmitSb(ChilkatStringBuilder sb)` |
| `FindObject` | method | `long FindObject(string name, string value, long caseSensitive)` |
| `FindString` | method | `long FindString(string value, long caseSensitive)` |
| `IntAt` | method | `long IntAt(long index)` |
| `IsNullAt` | method | `long IsNullAt(long index)` |
| `Load` | method | `long Load(string jsonArray)` |
| `LoadSb` | method | `long LoadSb(ChilkatStringBuilder sb)` |
| `ObjectAt` | method | `ChilkatJsonObject ObjectAt(long index)` |
| `ObjectAt2` | method | `long ObjectAt2(long index, ChilkatJsonObject jsonObj)` |
| `SetBoolAt` | method | `long SetBoolAt(long index, long value)` |
| `SetIntAt` | method | `long SetIntAt(long index, long value)` |
| `SetNullAt` | method | `long SetNullAt(long index)` |
| `SetNumberAt` | method | `long SetNumberAt(long index, string value)` |
| `SetStringAt` | method | `long SetStringAt(long index, string value)` |
| `SetUIntAt` | method | `long SetUIntAt(long index, long value)` |
| `StringAt` | method | `string StringAt(long index)` |
| `Swap` | method | `long Swap(long index1, long index2)` |
| `TypeAt` | method | `long TypeAt(long index)` |
| `UIntAt` | method | `long UIntAt(long index)` |

## Properties

### JsonArray.EmitCompact

`Chilkat 11.7.0 · powerbuilder · JsonArray · EmitCompact · property · read/write · since 9.5.0.64`

```powerbuilder
long EmitCompact
```

Controls whether emitted JSON is compact or pretty-formatted. If `1`, output contains no unnecessary whitespace and is emitted on a single line. If `0`, indentation and line breaks are added for readability. The default is `1`.

### JsonArray.EmitCrlf

`Chilkat 11.7.0 · powerbuilder · JsonArray · EmitCrlf · property · read/write · since 9.5.0.64`

```powerbuilder
long EmitCrlf
```

Controls line endings when pretty-formatted JSON is emitted. If `1`, line breaks use CRLF (); if `0`, they use LF (). The default is `1`.

**Applies only to pretty output:** When `EmitCompact` is `1`, the JSON is emitted on one line and this setting has no effect.

### JsonArray.FindStartIndex

`Chilkat 11.7.0 · powerbuilder · JsonArray · FindStartIndex · property · read/write · since 11.6.0`

```powerbuilder
long FindStartIndex
```

Specifies the zero-based array index at which `FindString` and `FindObject` begin searching. The default value is `0`.

**Iterating matches:** After finding a match at index `n`, set this property to `n + 1` before the next search to continue with later elements.

### JsonArray.Size

`Chilkat 11.7.0 · powerbuilder · JsonArray · Size · property · read-only · since 9.5.0.56`

```powerbuilder
long Size (read-only)
```

Returns the number of values currently contained in the JSON array. Array indexes therefore range from `0` through `Size - 1`.

## Methods

### JsonArray.AddArrayAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddArrayAt · method · since 9.5.0.56`

```powerbuilder
long AddArrayAt(long index)
```

Inserts a new, empty JSON array at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddArrayAt2

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddArrayAt2 · method · since 11.1.0`

```powerbuilder
long AddArrayAt2(long index, ChilkatJsonArray jarr)
```

Inserts a new, empty JSON array at zero-based position `index` and updates `jarr` to reference the newly inserted array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Immediate editing:** Because `jarr` references the inserted array, it can be populated directly without a separate `ArrayAt` lookup.

Returns 1 for success, 0 for failure.

### JsonArray.AddBoolAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddBoolAt · method · since 9.5.0.56`

```powerbuilder
long AddBoolAt(long index, long value)
```

Inserts a new JSON boolean value at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddIntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddIntAt · method · since 9.5.0.56`

```powerbuilder
long AddIntAt(long index, long value)
```

Inserts a new JSON integer value at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddNullAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddNullAt · method · since 9.5.0.56`

```powerbuilder
long AddNullAt(long index)
```

Inserts a JSON `null` value at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddNumberAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddNumberAt · method · since 9.5.0.56`

```powerbuilder
long AddNumberAt(long index, string numericStr)
```

Inserts a JSON number at zero-based position `index`. The `numericStr` argument supplies the exact JSON numeric text to store. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Exact numeric text:** Use this method when lexical form or precision matters, for example `12345678901234567890`, `1.2500`, or scientific notation. The supplied text must be valid JSON number syntax; JSON does not permit `NaN` or infinity.

Returns 1 for success, 0 for failure.

### JsonArray.AddObjectAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddObjectAt · method · since 9.5.0.56`

```powerbuilder
long AddObjectAt(long index)
```

Inserts a new, empty JSON object at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddObjectAt2

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddObjectAt2 · method · since 11.1.0`

```powerbuilder
long AddObjectAt2(long index, ChilkatJsonObject json)
```

Inserts a new, empty JSON object at zero-based position `index` and updates `json` to reference the newly inserted object.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Immediate editing:** Because `json` references the inserted object, it can be populated directly without a separate `ObjectAt` lookup.

Returns 1 for success, 0 for failure.

### JsonArray.AddObjectCopyAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddObjectCopyAt · method · since 9.5.0.82`

```powerbuilder
long AddObjectCopyAt(long index, ChilkatJsonObject jsonObj)
```

Inserts an independent copy of `jsonObj` at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Copy semantics:** The inserted object is copied rather than referenced. Later changes to the source `jsonObj` do not serve as edits to the inserted array value.

Returns 1 for success, 0 for failure.

### JsonArray.AddStringAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddStringAt · method · since 9.5.0.56`

```powerbuilder
long AddStringAt(long index, string value)
```

Inserts a new JSON string value at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AddUIntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · AddUIntAt · method · since 9.5.0.96`

```powerbuilder
long AddUIntAt(long index, long value)
```

Inserts a new JSON unsigned integer value at zero-based position `index`. Existing elements at that position and after it are shifted one position toward the end of the array.

|  |  |
| --- | --- |
| `0` | Insert as the first array element. |
| `-1` | Append as the last array element. |
| `n` | Insert at zero-based position n. |

**Insert vs. replace:** The `Add*At` methods insert a new array element. Use the corresponding `Set*At` method when replacing an existing element.

Returns 1 for success, 0 for failure.

### JsonArray.AppendArrayItems

`Chilkat 11.7.0 · powerbuilder · JsonArray · AppendArrayItems · method · since 9.5.0.82`

```powerbuilder
long AppendArrayItems(ChilkatJsonArray jarr)
```

Appends copies of all values from `jarr` to the end of this array, preserving their order.

**Source is unchanged:** The source array is not emptied or moved. This method is useful for concatenating JSON arrays, including arrays belonging to different JSON documents.

Returns 1 for success, 0 for failure.

### JsonArray.ArrayAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · ArrayAt · method · since 9.5.0.56`

```powerbuilder
ChilkatJsonArray ArrayAt(long index)
```

Returns the nested JSON array stored at zero-based position `index`.

**Reference, not copy:** The returned `JsonArray` refers to the existing nested array in the same JSON document. Changes made through the returned object modify that nested array.

**Type requirement:** The value at `index` must be an array. Use `TypeAt` when the value type is not already known.

Returns `null` on failure

### JsonArray.ArrayAt2

`Chilkat 11.7.0 · powerbuilder · JsonArray · ArrayAt2 · method · since 11.0.0`

```powerbuilder
long ArrayAt2(long index, ChilkatJsonArray jarr)
```

Updates `jarr` so that it references the nested JSON array stored at zero-based position `index`.

**Reference, not copy:** Changes made through `jarr` modify the existing nested array in the same JSON document.

Returns 1 for success, 0 for failure.

### JsonArray.BoolAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · BoolAt · method · since 9.5.0.56`

```powerbuilder
long BoolAt(long index)
```

Returns the boolean value stored at zero-based position `index`.

**Type-aware access:** Use `TypeAt` when the JSON type at `index` is not already known.

### JsonArray.Clear

`Chilkat 11.7.0 · powerbuilder · JsonArray · Clear · method · since 9.5.0.76`

```powerbuilder
Clear()
```

Removes all values from the array, leaving an empty JSON array (`[]`).

### JsonArray.DateAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · DateAt · method · since 9.5.0.73`

```powerbuilder
long DateAt(long index, CkDateTime dt)
```

Parses the date/time value at zero-based position `index` and loads the result into `dt`. Recognized forms include ISO 8601 timestamps (for example, `2009-11-04T19:55:41Z`), RFC 822-style date/time strings, and Unix timestamp integers.

**JSON has no native date type:** Dates are application conventions represented as strings or numbers. These methods recognize common representations and convert them to Chilkat date/time objects.

Returns 1 for success, 0 for failure.

### JsonArray.DeleteAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · DeleteAt · method · since 9.5.0.56`

```powerbuilder
long DeleteAt(long index)
```

Deletes the value at zero-based position `index`. Elements following the deleted value shift down by one position.

Returns 1 for success, 0 for failure.

### JsonArray.DtAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · DtAt · method · since 9.5.0.73`

```powerbuilder
long DtAt(long index, long bLocal, DtObj dt)
```

Parses the date/time value at zero-based position `index` and loads the result into `dt`. If `bLocal` is `1`, the populated fields represent local time; if `0`, they represent UTC/GMT. Recognized forms include ISO 8601 timestamps, RFC 822-style date/time strings, and Unix timestamp integers.

**JSON has no native date type:** Dates are application conventions represented as strings or numbers. These methods recognize common representations and convert them to Chilkat date/time objects.

Returns 1 for success, 0 for failure.

### JsonArray.Emit

`Chilkat 11.7.0 · powerbuilder · JsonArray · Emit · method · since 9.5.0.58`

```powerbuilder
string Emit()
```

Serializes this JSON array and returns the resulting JSON text.

**Formatting:** Set `EmitCompact` to choose compact versus pretty output. When pretty output is enabled, `EmitCrlf` selects CRLF or LF line endings.

Returns `null` on failure

### JsonArray.EmitSb

`Chilkat 11.7.0 · powerbuilder · JsonArray · EmitSb · method · since 9.5.0.65`

```powerbuilder
long EmitSb(ChilkatStringBuilder sb)
```

Serializes this JSON array into the supplied `StringBuilder`.

**Formatting:** Set `EmitCompact` to choose compact versus pretty output. When pretty output is enabled, `EmitCrlf` selects CRLF or LF line endings.

**Large JSON:** Using a `StringBuilder` can avoid returning a very large JSON document as a language-native string before passing it to another Chilkat method or writing it to a file.

Returns 1 for success, 0 for failure.

### JsonArray.FindObject

`Chilkat 11.7.0 · powerbuilder · JsonArray · FindObject · method · since 9.5.0.73`

```powerbuilder
long FindObject(string name, string value, long caseSensitive)
```

Searches array elements that are JSON objects and returns the zero-based index of the first object whose direct member `name` has a value matching `value`. Returns `-1` if no match is found. The value pattern may contain `*`, which matches zero or more characters. Set `caseSensitive` to control whether letter case must match.

**Member name, not JSON path:** `name` identifies a direct member of each object being tested; it is not a JSON path.

**Search start:** Searching begins at `FindStartIndex`, whose default is `0`. To continue searching after a match, set `FindStartIndex` to the previous returned index plus 1.

### JsonArray.FindString

`Chilkat 11.7.0 · powerbuilder · JsonArray · FindString · method · since 9.5.0.73`

```powerbuilder
long FindString(string value, long caseSensitive)
```

Searches for the first string array element matching `value` and returns its zero-based index, or `-1` if no match is found. The pattern may contain `*`, which matches zero or more characters. Set `caseSensitive` to control whether letter case must match.

**Search start:** Searching begins at `FindStartIndex`, whose default is `0`. To continue searching after a match, set `FindStartIndex` to the previous returned index plus 1.

### JsonArray.IntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · IntAt · method · since 9.5.0.56`

```powerbuilder
long IntAt(long index)
```

Returns the integer value stored at zero-based position `index`.

**Type-aware access:** Use `TypeAt` when the JSON type at `index` is not already known.

### JsonArray.IsNullAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · IsNullAt · method · since 9.5.0.56`

```powerbuilder
long IsNullAt(long index)
```

Returns `1` if the value at zero-based position `index` is the JSON value `null`; otherwise returns `0`.

**JSON null:** `null` is a distinct JSON value. It is not the same as an empty string, zero, `false`, an empty object, or an empty array.

### JsonArray.Load

`Chilkat 11.7.0 · powerbuilder · JsonArray · Load · method · since 9.5.0.64`

```powerbuilder
long Load(string jsonArray)
```

Parses the JSON array text in `jsonArray` and loads it into this object. The input must represent a JSON array, beginning with `[` and ending with `]`.

**Important — loading detaches the array:** Calling this method makes the `JsonArray` its own independent JSON document. If the object previously referenced an array nested inside another JSON document, that relationship is discarded. For this reason, call `Load`/`LoadSb` on a new `JsonArray` instance.

Returns 1 for success, 0 for failure.

### JsonArray.LoadSb

`Chilkat 11.7.0 · powerbuilder · JsonArray · LoadSb · method · since 9.5.0.64`

```powerbuilder
long LoadSb(ChilkatStringBuilder sb)
```

Parses the JSON array contained in `sb` and loads it into this object. The input must represent a JSON array, beginning with `[` and ending with `]`.

**Important — loading detaches the array:** Calling this method makes the `JsonArray` its own independent JSON document. If the object previously referenced an array nested inside another JSON document, that relationship is discarded. For this reason, call `Load`/`LoadSb` on a new `JsonArray` instance.

Returns 1 for success, 0 for failure.

### JsonArray.ObjectAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · ObjectAt · method · since 9.5.0.56`

```powerbuilder
ChilkatJsonObject ObjectAt(long index)
```

Returns the JSON object stored at zero-based position `index`.

**Reference, not copy:** The returned `JsonObject` refers to the existing object in the same JSON document. Changes made through the returned object modify that nested object.

**Type requirement:** The value at `index` must be an object. Use `TypeAt` when the value type is not already known.

Returns `null` on failure

### JsonArray.ObjectAt2

`Chilkat 11.7.0 · powerbuilder · JsonArray · ObjectAt2 · method · since 11.0.0`

```powerbuilder
long ObjectAt2(long index, ChilkatJsonObject jsonObj)
```

Updates `jsonObj` so that it references the JSON object stored at zero-based position `index`.

**Reference, not copy:** Changes made through `jsonObj` modify the existing object in the same JSON document.

Returns 1 for success, 0 for failure.

### JsonArray.SetBoolAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetBoolAt · method · since 9.5.0.56`

```powerbuilder
long SetBoolAt(long index, long value)
```

Replaces the value at zero-based position `index` with the specified JSON boolean value. The array length and the positions of other elements are unchanged.

Returns 1 for success, 0 for failure.

### JsonArray.SetIntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetIntAt · method · since 9.5.0.56`

```powerbuilder
long SetIntAt(long index, long value)
```

Replaces the value at zero-based position `index` with the specified JSON integer value. The array length and the positions of other elements are unchanged.

Returns 1 for success, 0 for failure.

### JsonArray.SetNullAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetNullAt · method · since 9.5.0.56`

```powerbuilder
long SetNullAt(long index)
```

Replaces the value at zero-based position `index` with the JSON value `null`. The array length and the positions of other elements are unchanged.

Returns 1 for success, 0 for failure.

### JsonArray.SetNumberAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetNumberAt · method · since 9.5.0.56`

```powerbuilder
long SetNumberAt(long index, string value)
```

Replaces the value at zero-based position `index` with a JSON number. The `value` argument supplies the exact JSON numeric text to store.

**Exact numeric text:** Use this method when lexical form or precision matters. The supplied text must be valid JSON number syntax; JSON does not permit `NaN` or infinity.

Returns 1 for success, 0 for failure.

### JsonArray.SetStringAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetStringAt · method · since 9.5.0.56`

```powerbuilder
long SetStringAt(long index, string value)
```

Replaces the value at zero-based position `index` with the specified JSON string value. The array length and the positions of other elements are unchanged.

Returns 1 for success, 0 for failure.

### JsonArray.SetUIntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · SetUIntAt · method · since 9.5.0.96`

```powerbuilder
long SetUIntAt(long index, long value)
```

Replaces the value at zero-based position `index` with the specified JSON unsigned integer value. The array length and the positions of other elements are unchanged.

Returns 1 for success, 0 for failure.

### JsonArray.StringAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · StringAt · method · since 9.5.0.56`

```powerbuilder
string StringAt(long index)
```

Returns the string value stored at zero-based position `index`.

**Type-aware access:** Use `TypeAt` when the JSON type at `index` is not already known.

Returns `null` on failure

### JsonArray.Swap

`Chilkat 11.7.0 · powerbuilder · JsonArray · Swap · method · since 9.5.0.76`

```powerbuilder
long Swap(long index1, long index2)
```

Exchanges the values at zero-based positions `index1` and `index2`. The array length does not change.

Returns 1 for success, 0 for failure.

### JsonArray.TypeAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · TypeAt · method · since 9.5.0.58`

```powerbuilder
long TypeAt(long index)
```

Returns an integer identifying the JSON type of the value at zero-based position `index`. Returns `-1` if no value exists at that index.

|  |  |
| --- | --- |
| `1` | string |
| `2` | number |
| `3` | object |
| `4` | array |
| `5` | boolean |
| `6` | null |

**Why use TypeAt:** JSON arrays may contain mixed types. Checking the type first avoids choosing a type-specific accessor such as `ObjectAt`, `ArrayAt`, or `IntAt` for the wrong kind of value.

### JsonArray.UIntAt

`Chilkat 11.7.0 · powerbuilder · JsonArray · UIntAt · method · since 9.5.0.96`

```powerbuilder
long UIntAt(long index)
```

Returns the unsigned integer value stored at zero-based position `index`.

**Type-aware access:** Use `TypeAt` when the JSON type at `index` is not already known.

## Related classes

[`CkDateTime`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/CkDateTime.md), [`DtObj`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/DtObj.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/JsonObject.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/StringBuilder.md)

