---
product: Chilkat
product_version: 11.7.0
language: js
language_label: JavaScript
class: JsonObject
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/jsJsonObjectRef.html
---
# Chilkat JsonObject — JavaScript — v11.7.0

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

## Purpose

**Load, navigate, create, modify, search, sort, and emit JSON objects.**

`Chilkat.JsonObject` provides DOM-style access to JSON objects. It can load, inspect, modify, create, search, sort, emit, and save JSON data. It supports path-based access, index-based member access, automatic creation of nested paths, object and array references, Firebase-style updates, record searches, date/time conversion, binary data encoding, variable substitution, and optional secure secret resolution.

**Load and emit JSON**

Load JSON from strings, files, buffers, or Chilkat objects, then emit the result as compact or pretty-formatted JSON.

**Path-based navigation**

Read and update nested values using JSON paths, with support for automatically creating missing object or array paths.

**Member access**

Access object members by name or index, inspect member types, retrieve values, and remove or rename members as needed.

**Nested objects and arrays**

Work directly with child `JsonObject` and `JsonArray` references to navigate and modify complex JSON structures.

**Search and transform**

Search records, sort object members, perform Firebase-style updates, and prepare JSON for API requests or application storage.

**Special value handling**

Handle date/time values, binary data encodings, exact numeric text, variable substitution, and secure secret resolution.

**Common pattern:** Load or create a `JsonObject`, navigate named members and nested paths, retrieve child arrays as `JsonArray` objects when ordered lists are encountered, update values as needed, then emit or save the final JSON. Use `JsonObject` for named JSON members and `JsonArray` for ordered lists.

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

## Object creation, unlocking and error handling

**Object Creation**

Note: This is intended for running within a [Chilkat.Js embedded JavaScript engine](https://www.chilkatsoft.com/chilkat_javascript_engine.asp).

```
var obj = new CkJsonObject();
```

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 JavaScript.

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` | `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. |
| `LastErrorHtml` | `LastErrorHtml` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `LastErrorText` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `LastErrorXml` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `LastMethodSuccess` | read/write | Indicates the success or failure of the most recent method call: `true` means success, `false` means failure. |
| `VerboseLogging` | `VerboseLogging` | read/write | If set to `true`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `Version` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `DelimiterChar` | property, read/write | `DelimiterChar` |
| `EmitCompact` | property, read/write | `EmitCompact` |
| `EmitCrLf` | property, read/write | `EmitCrLf` |
| `EnableSecrets` | property, read/write | `EnableSecrets` |
| `I` | property, read/write | `I` |
| `J` | property, read/write | `J` |
| `K` | property, read/write | `K` |
| `LowerCaseNames` | property, read/write | `LowerCaseNames` |
| `PathPrefix` | property, read/write | `PathPrefix` |
| `Size` | property, read-only | `Size` |
| `Strict` | property, read/write | `Strict` |
| `UncommonOptions` | property, read/write | `UncommonOptions` |
| `AddArrayAt` | method | `var success = AddArrayAt(index, name);` |
| `AddArrayCopyAt` | method | `var success = AddArrayCopyAt(index, name, jarr);` |
| `AddBoolAt` | method | `var success = AddBoolAt(index, name, value);` |
| `AddIntAt` | method | `var success = AddIntAt(index, name, value);` |
| `AddNullAt` | method | `var success = AddNullAt(index, name);` |
| `AddNumberAt` | method | `var success = AddNumberAt(index, name, numericStr);` |
| `AddObjectAt` | method | `var success = AddObjectAt(index, name);` |
| `AddObjectCopyAt` | method | `var success = AddObjectCopyAt(index, name, jsonObj);` |
| `AddStringAt` | method | `var success = AddStringAt(index, name, value);` |
| `AppendArray2` | method | `var success = AppendArray2(name, jarr);` |
| `AppendArrayCopy` | method | `var success = AppendArrayCopy(name, jarr);` |
| `AppendBool` | method | `var success = AppendBool(name, value);` |
| `AppendInt` | method | `var success = AppendInt(name, value);` |
| `AppendObject2` | method | `var success = AppendObject2(name, jsonObj);` |
| `AppendObjectCopy` | method | `var success = AppendObjectCopy(name, jsonObj);` |
| `AppendString` | method | `var success = AppendString(name, value);` |
| `AppendStringArray` | method | `var success = AppendStringArray(name, values);` |
| `ArrayAt2` | method | `var success = ArrayAt2(index, jarr);` |
| `ArrayOf2` | method | `var success = ArrayOf2(jsonPath, jarr);` |
| `BoolAt` | method | `var boolVal = BoolAt(index);` |
| `BoolOf` | method | `var boolVal = BoolOf(jsonPath);` |
| `BytesOf` | method | `var success = BytesOf(jsonPath, encoding, bd);` |
| `Clear` | method | `Clear();` |
| `CopyRef` | method | `var success = CopyRef(jsonObj);` |
| `DateOf` | method | `var success = DateOf(jsonPath, dt);` |
| `Delete` | method | `var success = Delete(name);` |
| `DeleteAt` | method | `var success = DeleteAt(index);` |
| `DeleteRecords` | method | `var intVal = DeleteRecords(arrayPath, relpath, value, caseSensitive);` |
| `DtOf` | method | `var success = DtOf(jsonPath, bLocal, dt);` |
| `Emit` | method | `var strVal = Emit();` |
| `EmitBd` | method | `var success = EmitBd(bd);` |
| `EmitSb` | method | `var success = EmitSb(sb);` |
| `EmitWithSubs` | method | `var strVal = EmitWithSubs(subs, omitEmpty);` |
| `FindObjectWithMember2` | method | `var success = FindObjectWithMember2(name, jsonObj);` |
| `FindRecord2` | method | `var success = FindRecord2(arrayPath, relPath, value, caseSensitive, jsonObj);` |
| `FindRecordString` | method | `var strVal = FindRecordString(arrayPath, relPath, value, caseSensitive, retRelPath);` |
| `FirebaseApplyEvent` | method | `var success = FirebaseApplyEvent(name, data);` |
| `FirebasePatch` | method | `var success = FirebasePatch(jsonPath, jsonData);` |
| `FirebasePut` | method | `var success = FirebasePut(jsonPath, value);` |
| `GetDocRoot2` | method | `var success = GetDocRoot2(docRoot);` |
| `HasMember` | method | `var success = HasMember(jsonPath);` |
| `IndexOf` | method | `var intVal = IndexOf(name);` |
| `IntAt` | method | `var intVal = IntAt(index);` |
| `IntOf` | method | `var intVal = IntOf(jsonPath);` |
| `IsNullAt` | method | `var boolVal = IsNullAt(index);` |
| `IsNullOf` | method | `var boolVal = IsNullOf(jsonPath);` |
| `JsonTypeOf` | method | `var intVal = JsonTypeOf(jsonPath);` |
| `Load` | method | `var success = Load(json);` |
| `LoadBd` | method | `var success = LoadBd(bd);` |
| `LoadFile` | method | `var success = LoadFile(path);` |
| `LoadPredefined` | method | `var success = LoadPredefined(name);` |
| `LoadSb` | method | `var success = LoadSb(sb);` |
| `MakeCopy` | method | `var success = MakeCopy(json);` |
| `MoveMember` | method | `var success = MoveMember(fromIndex, toIndex);` |
| `NameAt` | method | `var strVal = NameAt(index);` |
| `NewArrayOf` | method | `var success = NewArrayOf(path, jArr);` |
| `NewObjectOf` | method | `var success = NewObjectOf(path, jObj);` |
| `ObjectAt2` | method | `var success = ObjectAt2(index, jsonObj);` |
| `ObjectOf2` | method | `var success = ObjectOf2(jsonPath, jsonObj);` |
| `Predefine` | method | `var success = Predefine(name);` |
| `Rename` | method | `var success = Rename(oldName, newName);` |
| `RenameAt` | method | `var success = RenameAt(index, name);` |
| `SetBoolAt` | method | `var success = SetBoolAt(index, value);` |
| `SetBoolOf` | method | `var success = SetBoolOf(jsonPath, value);` |
| `SetIntAt` | method | `var success = SetIntAt(index, value);` |
| `SetIntOf` | method | `var success = SetIntOf(jsonPath, value);` |
| `SetNullAt` | method | `var success = SetNullAt(index);` |
| `SetNullOf` | method | `var success = SetNullOf(jsonPath);` |
| `SetNumberAt` | method | `var success = SetNumberAt(index, value);` |
| `SetNumberOf` | method | `var success = SetNumberOf(jsonPath, value);` |
| `SetStringAt` | method | `var success = SetStringAt(index, value);` |
| `SetStringOf` | method | `var success = SetStringOf(jsonPath, value);` |
| `SizeOfArray` | method | `var intVal = SizeOfArray(jsonPath);` |
| `Sort` | method | `Sort(ascending, caseSensitive);` |
| `StringAt` | method | `var strVal = StringAt(index);` |
| `StringOf` | method | `var strVal = StringOf(jsonPath);` |
| `StringOfEquals` | method | `var boolVal = StringOfEquals(jsonPath, value, caseSensitive);` |
| `StringOfSb` | method | `var success = StringOfSb(jsonPath, sb);` |
| `Swap` | method | `var success = Swap(index1, index2);` |
| `TypeAt` | method | `var intVal = TypeAt(index);` |
| `UIntOf` | method | `var uintVal = UIntOf(jsonPath);` |
| `UpdateBd` | method | `var success = UpdateBd(jsonPath, encoding, bd);` |
| `UpdateBool` | method | `var success = UpdateBool(jsonPath, value);` |
| `UpdateInt` | method | `var success = UpdateInt(jsonPath, value);` |
| `UpdateNewArray` | method | `var success = UpdateNewArray(jsonPath);` |
| `UpdateNewObject` | method | `var success = UpdateNewObject(jsonPath);` |
| `UpdateNull` | method | `var success = UpdateNull(jsonPath);` |
| `UpdateNumber` | method | `var success = UpdateNumber(jsonPath, numericStr);` |
| `UpdateSb` | method | `var success = UpdateSb(jsonPath, sb);` |
| `UpdateString` | method | `var success = UpdateString(jsonPath, value);` |
| `UpdateUInt` | method | `var success = UpdateUInt(jsonPath, value);` |
| `WriteFile` | method | `var success = WriteFile(path);` |

## Properties

### JsonObject.DelimiterChar

`Chilkat 11.7.0 · js · JsonObject · DelimiterChar · property · read/write · since 9.5.0.58`

```javascript
DelimiterChar
```

· `string`

Specifies the character used to separate object-member names in Chilkat JSON paths. The default is `.`. Set it to `/` for Firebase-style paths. This property should contain exactly one character.

**Arrays in paths:** Array indexes continue to use square brackets, such as `orders[0].id`. If a member name itself contains a path-separator character, quote that path component with double quotes.

### JsonObject.EmitCompact

`Chilkat 11.7.0 · js · JsonObject · EmitCompact · property · read/write · since 9.5.0.56`

```javascript
EmitCompact
```

· `boolean`

Controls whether emitted JSON is compact or pretty-printed. The default is `true`.

|  |  |
| --- | --- |
| `true` | Emit a compact representation with no extra formatting whitespace. |
| `false` | Emit indented, human-readable JSON. |

**JSON semantics:** Formatting whitespace does not change the JSON data. Use compact output for transport/storage and pretty output for diagnostics or human review.

### JsonObject.EmitCrLf

`Chilkat 11.7.0 · js · JsonObject · EmitCrLf · property · read/write · since 9.5.0.56`

```javascript
EmitCrLf
```

· `boolean`

Controls line endings when pretty-printed JSON is emitted (`EmitCompact = false`). The default is `true`.

|  |  |
| --- | --- |
| `true` | Use CRLF line endings. |
| `false` | Use LF line endings. |

**Compact output:** This setting has no effect when `EmitCompact` is `true` because compact JSON is emitted without formatting line breaks.

### JsonObject.EnableSecrets

`Chilkat 11.7.0 · js · JsonObject · EnableSecrets · property · read/write · since 11.5.0`

```javascript
EnableSecrets
```

**Full documentation for this property (same in every language):** [More Detailed Information About EnableSecrets](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/secret_specification_strings.md)

· `boolean`

Enables automatic resolution of Chilkat secret specification strings for supported string-setting methods. The default is `false`. When enabled, a value beginning with `!!` can identify a credential stored in Windows Credential Manager or Apple Keychain instead of embedding the literal secret in application code.

Secret specification format: `!![appName|]service[|domain]|username`.

This feature applies to `AddStringAt`, `AppendString`, `SetStringAt`, `SetStringOf`, `UpdateSb`, and `UpdateString`.

**Security:** Secret resolution changes where the string value comes from; the resulting JSON member still contains the resolved value. Avoid emitting or logging JSON that contains credentials unless that exposure is explicitly intended.

### JsonObject.I

`Chilkat 11.7.0 · js · JsonObject · I · property · read/write · since 9.5.0.56`

```javascript
I
```

· `int`

Supplies the integer substituted for `i` when a JSON path contains an array index such as `[i]`. This is useful for loop-based navigation without constructing a new path string for every iteration.

**Related properties:** The `J` and `K` properties provide the same substitution behavior for `[j]` and `[k]`.

### JsonObject.J

`Chilkat 11.7.0 · js · JsonObject · J · property · read/write · since 9.5.0.56`

```javascript
J
```

· `int`

Supplies the integer substituted for `j` when a JSON path contains `[j]`. It is commonly used with nested-array paths such as `matrix[i][j]`.

### JsonObject.K

`Chilkat 11.7.0 · js · JsonObject · K · property · read/write · since 9.5.0.56`

```javascript
K
```

· `int`

Supplies the integer substituted for `k` when a JSON path contains `[k]`. It can be combined with `I` and `J` for deeper nested-array traversal.

### JsonObject.LowerCaseNames

`Chilkat 11.7.0 · js · JsonObject · LowerCaseNames · property · read/write · since 9.5.0.87`

```javascript
LowerCaseNames
```

· `boolean`

If `true`, member names are converted to lowercase while JSON is loaded by `Load`, `LoadBd`, `LoadSb`, or `LoadFile`. The default is `false`.

**Important:** This changes member names in the parsed document; it is not merely a case-insensitive lookup mode. Use it only when normalizing names is intentional.

### JsonObject.PathPrefix

`Chilkat 11.7.0 · js · JsonObject · PathPrefix · property · read/write · since 9.5.0.76`

```javascript
PathPrefix
```

· `string`

Specifies a path prefix automatically prepended to JSON paths passed to path-based methods such as `StringOf`, `ObjectOf`, `UpdateString`, `SetBoolOf`, and `SizeOfArray`. The default is the empty string.

**Use case:** Set a prefix when many operations target the same nested object. The individual method calls can then use paths relative to that prefix.

### JsonObject.Size

`Chilkat 11.7.0 · js · JsonObject · Size · property · read-only · since 9.5.0.56`

```javascript
Size
```

· `int`, `read-only`

Returns the number of direct name/value members in this JSON object. Nested members inside child objects are not included.

**JSON objects and order:** RFC 8259 defines a JSON object as an unordered collection of name/value pairs. Chilkat preserves a member order so index-based APIs and deterministic emission are possible, but interoperable application logic should generally use member names rather than depend on object order.

### JsonObject.Strict

`Chilkat 11.7.0 · js · JsonObject · Strict · property · read/write · since 11.6.0`

```javascript
Strict
```

· `boolean`

When `Strict` is **true**, the Load methods first check that the data is well-formed JSON. If it is not, the load fails and the contents of this JsonObject are left **unchanged**. The default is `false`.

This applies to `Load`, `LoadSb`, `LoadBd`, `LoadFile` and `LoadPredefined`.

Chilkat's JSON parser is deliberately tolerant. By default it can accept text that is not well-formed, succeed, and leave an empty or partially populated document. That is convenient when the goal is a best-effort parse of imperfect input, but it is the wrong behavior when a silently missing member changes what the application does. A single missing comma, for example, can cause the members after it to be dropped while the load still reports success.

Set `Strict` to `true` for JSON carrying configuration, credentials, or security parameters, where a member that quietly failed to load would be acted on as though it had never been specified.

**Note:** The default is `false` so that existing applications are unaffected. When a strict load is rejected, this JsonObject keeps whatever it held before the call, so a failed reload never leaves the object empty.

### JsonObject.UncommonOptions

`Chilkat 11.7.0 · js · JsonObject · UncommonOptions · property · read/write · since 9.5.0.90`

```javascript
UncommonOptions
```

· `string`

Provides a catch-all string for uncommon, implementation-specific options. The default is the empty string and it should normally remain empty.

**Recommendation:** Do not invent option keywords. Set this property only when a specific `JsonObject` option is documented by Chilkat or provided by Chilkat support.

## Methods

### JsonObject.AddArrayAt

`Chilkat 11.7.0 · js · JsonObject · AddArrayAt · method · since 9.5.0.56`

```javascript
var success = AddArrayAt(index, name);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`

Inserts a new JSON array member named `name` at the zero-based member position `index`. The new array is empty.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddArrayCopyAt

`Chilkat 11.7.0 · js · JsonObject · AddArrayCopyAt · method · since 9.5.0.82`

```javascript
var success = AddArrayCopyAt(index, name, jarr);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· jarr: `CkJsonArray`

Inserts a new JSON array member named `name` at the zero-based member position `index`. The array value is copied from `jarr`; subsequent changes to the source array do not modify the inserted copy.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddBoolAt

`Chilkat 11.7.0 · js · JsonObject · AddBoolAt · method · since 9.5.0.56`

```javascript
var success = AddBoolAt(index, name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· value: `boolean`

Inserts a new JSON boolean member named `name` at the zero-based member position `index`. The value is taken from `value`.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddIntAt

`Chilkat 11.7.0 · js · JsonObject · AddIntAt · method · since 9.5.0.56`

```javascript
var success = AddIntAt(index, name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· value: `int`

Inserts a new JSON number member named `name` at the zero-based member position `index`. The integer `value` is emitted as a JSON number, not as a quoted string.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddNullAt

`Chilkat 11.7.0 · js · JsonObject · AddNullAt · method · since 9.5.0.56`

```javascript
var success = AddNullAt(index, name);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`

Inserts a new JSON null member named `name` at the zero-based member position `index`.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddNumberAt

`Chilkat 11.7.0 · js · JsonObject · AddNumberAt · method · since 9.5.0.56`

```javascript
var success = AddNumberAt(index, name, numericStr);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· numericStr: `string`

Inserts a new JSON number member named `name` at the zero-based member position `index`. The `numericStr` argument supplies the exact JSON numeric text to store.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

**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 true for success, false for failure.

### JsonObject.AddObjectAt

`Chilkat 11.7.0 · js · JsonObject · AddObjectAt · method · since 9.5.0.56`

```javascript
var success = AddObjectAt(index, name);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`

Inserts a new JSON object member named `name` at the zero-based member position `index`. The new object is empty.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddObjectCopyAt

`Chilkat 11.7.0 · js · JsonObject · AddObjectCopyAt · method · since 9.5.0.82`

```javascript
var success = AddObjectCopyAt(index, name, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· jsonObj: `CkJsonObject`

Inserts a new JSON object member named `name` at the zero-based member position `index`. The object value is copied from `jsonObj`; the inserted value is independent of the source.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AddStringAt

`Chilkat 11.7.0 · js · JsonObject · AddStringAt · method · since 9.5.0.56`

```javascript
var success = AddStringAt(index, name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`  
· value: `string`

Inserts a new JSON string member named `name` at the zero-based member position `index`. The value is stored as a JSON string and is escaped as needed when emitted.

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

**Member name vs. JSON path:** `name` is a direct member name, not a JSON path. Use an `Update*` or `Set*Of` method when addressing a nested value by path.

Returns true for success, false for failure.

### JsonObject.AppendArray2

`Chilkat 11.7.0 · js · JsonObject · AppendArray2 · method · since 11.0.0`

```javascript
var success = AppendArray2(name, jarr);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· jarr: `CkJsonArray`

Appends a new JSON array member named `name` to this object. A new empty array is created and `jarr` is updated to reference it. The method returns `true` on success.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendArrayCopy

`Chilkat 11.7.0 · js · JsonObject · AppendArrayCopy · method · since 9.5.0.82`

```javascript
var success = AppendArrayCopy(name, jarr);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· jarr: `CkJsonArray`

Appends a new JSON array member named `name` to this object. The array is copied from `jarr`, so the appended array is independent of the source array.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendBool

`Chilkat 11.7.0 · js · JsonObject · AppendBool · method · since 9.5.0.58`

```javascript
var success = AppendBool(name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· value: `boolean`

Appends a new JSON boolean member named `name` to this object. The value is taken from `value`.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendInt

`Chilkat 11.7.0 · js · JsonObject · AppendInt · method · since 9.5.0.58`

```javascript
var success = AppendInt(name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· value: `int`

Appends a new JSON number member named `name` to this object. The integer value is stored as a JSON number.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendObject2

`Chilkat 11.7.0 · js · JsonObject · AppendObject2 · method · since 11.0.0`

```javascript
var success = AppendObject2(name, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· jsonObj: `CkJsonObject`

Appends a new JSON object member named `name` to this object. A new empty object is created and `jsonObj` is updated to reference it. The method returns `true` on success.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendObjectCopy

`Chilkat 11.7.0 · js · JsonObject · AppendObjectCopy · method · since 9.5.0.82`

```javascript
var success = AppendObjectCopy(name, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· jsonObj: `CkJsonObject`

Appends a new JSON object member named `name` to this object. The object is copied from `jsonObj`, so the appended object is independent of the source object.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendString

`Chilkat 11.7.0 · js · JsonObject · AppendString · method · since 9.5.0.58`

```javascript
var success = AppendString(name, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· value: `string`

Appends a new JSON string member named `name` to this object. The value is JSON-escaped as needed when emitted.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.AppendStringArray

`Chilkat 11.7.0 · js · JsonObject · AppendStringArray · method · since 9.5.0.67`

```javascript
var success = AppendStringArray(name, values);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· values: `CkStringTable`

Appends a new JSON array member named `name` to this object. The array is populated with the strings contained in `values`.

**Member name vs. JSON path:** `name` is a direct member name. It is not interpreted as a JSON path. Use the corresponding `Update*` method when a nested path should be addressed or created.

Returns true for success, false for failure.

### JsonObject.ArrayAt2

`Chilkat 11.7.0 · js · JsonObject · ArrayAt2 · method · since 11.0.0`

```javascript
var success = ArrayAt2(index, jarr);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· jarr: `CkJsonArray`

Updates `jarr` to reference the JSON array stored at zero-based member position `index` and returns `true` on success.

Returns true for success, false for failure.

### JsonObject.ArrayOf2

`Chilkat 11.7.0 · js · JsonObject · ArrayOf2 · method · since 11.1.0`

```javascript
var success = ArrayOf2(jsonPath, jarr);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· jarr: `CkJsonArray`

Updates `jarr` to reference the JSON array at `jsonPath` and returns `true` on success.

Returns true for success, false for failure.

### JsonObject.BoolAt

`Chilkat 11.7.0 · js · JsonObject · BoolAt · method · since 9.5.0.56`

```javascript
var boolVal = BoolAt(index);
```

· return: `boolean`  
· index: `int`

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

**Indexing:** Member indexes are based on the order maintained by this `JsonObject` instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.

### JsonObject.BoolOf

`Chilkat 11.7.0 · js · JsonObject · BoolOf · method · since 9.5.0.56`

```javascript
var boolVal = BoolOf(jsonPath);
```

· return: `boolean`  
· jsonPath: `string`

Returns the boolean value at `jsonPath`. The path is evaluated relative to this `JsonObject`, after applying `PathPrefix` if one is set.

### JsonObject.BytesOf

`Chilkat 11.7.0 · js · JsonObject · BytesOf · method · since 9.5.0.68`

```javascript
var success = BytesOf(jsonPath, encoding, bd);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· encoding: `string`  
· bd: `CkBinData`

Reads the string value at `jsonPath`, decodes it using `encoding` (for example, `base64` or `hex`), and appends the resulting bytes to `bd`.

**Binary-in-JSON convention:** The JSON member itself is text. The `encoding` argument tells Chilkat how that text represents the original bytes.

Returns true for success, false for failure.

### JsonObject.Clear

`Chilkat 11.7.0 · js · JsonObject · Clear · method · since 9.5.0.76`

```javascript
Clear();
```

· return: `undefined`

Removes all members from this JSON object, leaving an empty object equivalent to `{}`.

### JsonObject.CopyRef

`Chilkat 11.7.0 · js · JsonObject · CopyRef · method · since 11.0.0`

```javascript
var success = CopyRef(jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonObj: `CkJsonObject`

Updates `jsonObj` so that it references the same JSON object as the caller. No JSON data is copied.

**Shared state:** After this call, modifications through either reference affect the same underlying JSON object.

Returns true for success, false for failure.

### JsonObject.DateOf

`Chilkat 11.7.0 · js · JsonObject · DateOf · method · since 9.5.0.73`

```javascript
var success = DateOf(jsonPath, dt);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· dt: `CkDateTime`

Parses the date/time value at `jsonPath` 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 in JSON are application conventions, usually represented as strings or numbers. This method recognizes common conventions and converts them to `CkDateTime`.

Returns true for success, false for failure.

### JsonObject.Delete

`Chilkat 11.7.0 · js · JsonObject · Delete · method · since 9.5.0.56`

```javascript
var success = Delete(name);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`

Deletes the direct member named `name` from this JSON object.

**Not a path:** `name` is a member name, not a JSON path. Use a path-based operation when deleting or replacing a nested value requires navigation first.

Returns true for success, false for failure.

### JsonObject.DeleteAt

`Chilkat 11.7.0 · js · JsonObject · DeleteAt · method · since 9.5.0.56`

```javascript
var success = DeleteAt(index);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`

Deletes the member at zero-based position `index`. Members after the deleted position shift toward the beginning.

Returns true for success, false for failure.

### JsonObject.DeleteRecords

`Chilkat 11.7.0 · js · JsonObject · DeleteRecords · method · since 9.5.0.88`

```javascript
var intVal = DeleteRecords(arrayPath, relpath, value, caseSensitive);
```

· return: `int`  
· arrayPath: `string`  
· relpath: `string`  
· value: `string`  
· caseSensitive: `boolean`

Deletes every object record in the array at `arrayPath` whose value at relative path `relpath` equals or wildcard-matches `value`. The `caseSensitive` argument controls matching. Returns the number of records deleted.

### JsonObject.DtOf

`Chilkat 11.7.0 · js · JsonObject · DtOf · method · since 9.5.0.73`

```javascript
var success = DtOf(jsonPath, bLocal, dt);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· bLocal: `boolean`  
· dt: `CkDtObj`

Parses the date/time value at `jsonPath` into `dt`. If `bLocal` is `true`, the destination receives local date/time fields; otherwise it receives UTC/GMT fields. Recognized inputs include ISO 8601 timestamps, RFC 822-style date/time strings, and Unix timestamp integers.

Returns true for success, false for failure.

### JsonObject.Emit

`Chilkat 11.7.0 · js · JsonObject · Emit · method · since 9.5.0.56`

```javascript
var strVal = Emit();
```

· return: `string`

Serializes the JSON document rooted at this object and returns the JSON text. Formatting is controlled by `EmitCompact` and, for pretty output, `EmitCrLf`.

**Object member order:** Chilkat emits members in its maintained order, but JSON object ordering is not semantically significant under RFC 8259.

Returns `null` on failure

### JsonObject.EmitBd

`Chilkat 11.7.0 · js · JsonObject · EmitBd · method · since 9.5.0.77`

```javascript
var success = EmitBd(bd);
```

· return: `boolean`; `true` for success, `false` for failure  
· bd: `CkBinData`

Serializes this JSON and appends the resulting bytes to `bd`.

**Append behavior:** Existing data in the destination `BinData` is preserved.

Returns true for success, false for failure.

### JsonObject.EmitSb

`Chilkat 11.7.0 · js · JsonObject · EmitSb · method · since 9.5.0.62`

```javascript
var success = EmitSb(sb);
```

· return: `boolean`; `true` for success, `false` for failure  
· sb: `CkStringBuilder`

Serializes this JSON and appends the resulting text to `sb`. Formatting follows `EmitCompact` and `EmitCrLf`.

**Append behavior:** Existing text in the destination `StringBuilder` is preserved; the emitted JSON is added after it.

Returns true for success, false for failure.

### JsonObject.EmitWithSubs

`Chilkat 11.7.0 · js · JsonObject · EmitWithSubs · method · since 9.5.0.67`

```javascript
var strVal = EmitWithSubs(subs, omitEmpty);
```

· return: `string`  
· subs: `CkHashtable`  
· omitEmpty: `boolean`

Serializes the JSON after substituting variables from `subs` into template strings. A placeholder such as `{$name}` is replaced by the corresponding hashtable value. Prefixing the variable name with `i.`, as in `{$i.count}`, emits the substituted value as a JSON integer instead of a quoted string.

If `omitEmpty` is `true`, members whose substituted result is an empty string or empty array are omitted from the emitted JSON.

**Template reuse:** This method does not require rebuilding the JSON template. It is commonly paired with `Predefine` and `LoadPredefined` when the same JSON shape is emitted repeatedly with different values.

Returns `null` on failure

### JsonObject.FindObjectWithMember2

`Chilkat 11.7.0 · js · JsonObject · FindObjectWithMember2 · method · since 11.0.0`

```javascript
var success = FindObjectWithMember2(name, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· jsonObj: `CkJsonObject`

Recursively searches this JSON subtree for the first object containing a direct member named `name`. On success, `jsonObj` is updated to reference the matching object and the method returns `true`.

Returns true for success, false for failure.

### JsonObject.FindRecord2

`Chilkat 11.7.0 · js · JsonObject · FindRecord2 · method · since 11.0.0`

```javascript
var success = FindRecord2(arrayPath, relPath, value, caseSensitive, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· arrayPath: `string`  
· relPath: `string`  
· value: `string`  
· caseSensitive: `boolean`  
· jsonObj: `CkJsonObject`

Searches the JSON array at `arrayPath` using the same matching rules as `FindRecord`. On success, `jsonObj` is updated to reference the first matching record and the method returns `true`.

**Reference semantics:** The destination references the record in the original JSON document; changes made through `jsonObj` modify that record.

Returns true for success, false for failure.

### JsonObject.FindRecordString

`Chilkat 11.7.0 · js · JsonObject · FindRecordString · method · since 9.5.0.63`

```javascript
var strVal = FindRecordString(arrayPath, relPath, value, caseSensitive, retRelPath);
```

· return: `string`  
· arrayPath: `string`  
· relPath: `string`  
· value: `string`  
· caseSensitive: `boolean`  
· retRelPath: `string`

Searches the JSON array at `arrayPath` for the first record whose `relPath` value equals or wildcard-matches `value`, then returns the value at `retRelPath` from that same record as a string.

**Typical use:** This is useful for lookups such as “find the record where `Name` is `Advertising` and return its `Id`.” The `*` wildcard may be used in `value`.

Returns `null` on failure

### JsonObject.FirebaseApplyEvent

`Chilkat 11.7.0 · js · JsonObject · FirebaseApplyEvent · method · since 9.5.0.58`

```javascript
var success = FirebaseApplyEvent(name, data);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`  
· data: `string`

Applies a Firebase Realtime Database event to this JSON object. `name` should be `put` or `patch`, and `data` should contain event JSON such as `{"path":"/","data":{"a":1,"b":2}}`.

**Purpose:** This method is useful when maintaining a local JSON representation from Firebase server-sent events: `put` replaces the value at a path, while `patch` updates individual child keys.

Returns true for success, false for failure.

### JsonObject.FirebasePatch

`Chilkat 11.7.0 · js · JsonObject · FirebasePatch · method · since 9.5.0.58`

```javascript
var success = FirebasePatch(jsonPath, jsonData);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· jsonData: `string`

Applies Firebase-style patch semantics at `jsonPath`. `jsonData` must contain a JSON object; each key in that object updates or adds the corresponding key at the target path.

**Relative path:** `jsonPath` is relative to this `JsonObject`.

Returns true for success, false for failure.

### JsonObject.FirebasePut

`Chilkat 11.7.0 · js · JsonObject · FirebasePut · method · since 9.5.0.58`

```javascript
var success = FirebasePut(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `string`

Applies Firebase-style put semantics at `jsonPath`, replacing or inserting the value at that path. `value` is JSON text and may represent an object, array, number, boolean, `null`, or a quoted JSON string.

**Quoted strings:** To store a string through this method, `value` must contain a valid JSON string literal, including its surrounding double quotes. Use `UpdateString` when you already have an ordinary application string.

Returns true for success, false for failure.

### JsonObject.GetDocRoot2

`Chilkat 11.7.0 · js · JsonObject · GetDocRoot2 · method · since 11.0.0`

```javascript
var success = GetDocRoot2(docRoot);
```

· return: `boolean`; `true` for success, `false` for failure  
· docRoot: `CkJsonObject`

Updates `docRoot` to reference the root object of the JSON document containing the caller and returns `true` on success.

**Reference semantics:** The destination is another reference into the same underlying document; it is not a copy.

Returns true for success, false for failure.

### JsonObject.HasMember

`Chilkat 11.7.0 · js · JsonObject · HasMember · method · since 9.5.0.58`

```javascript
var success = HasMember(jsonPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`

Returns `true` if a value exists at `jsonPath`; otherwise returns `false`.

**Missing vs. null:** A member whose JSON value is `null` still exists. Use `IsNullOf` to test specifically for JSON `null`.

Returns true for success, false for failure.

### JsonObject.IndexOf

`Chilkat 11.7.0 · js · JsonObject · IndexOf · method · since 9.5.0.56`

```javascript
var intVal = IndexOf(name);
```

· return: `int`  
· name: `string`

Returns the zero-based position of the direct member named `name`, or `-1` if that member name is not found.

**Not a path:** `name` is searched only among the direct members of this object.

### JsonObject.IntAt

`Chilkat 11.7.0 · js · JsonObject · IntAt · method · since 9.5.0.56`

```javascript
var intVal = IntAt(index);
```

· return: `int`  
· index: `int`

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

**Indexing:** Member indexes are based on the order maintained by this `JsonObject` instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.

### JsonObject.IntOf

`Chilkat 11.7.0 · js · JsonObject · IntOf · method · since 9.5.0.56`

```javascript
var intVal = IntOf(jsonPath);
```

· return: `int`  
· jsonPath: `string`

Returns the integer value at `jsonPath`. The path is evaluated relative to this `JsonObject`, after applying `PathPrefix` if one is set.

**Large numbers:** Use `StringOf` or the exact numeric-text APIs when a JSON integer may exceed the range of the language binding's integer type.

### JsonObject.IsNullAt

`Chilkat 11.7.0 · js · JsonObject · IsNullAt · method · since 9.5.0.56`

```javascript
var boolVal = IsNullAt(index);
```

· return: `boolean`  
· index: `int`

Returns `true` if the member at zero-based position `index` has the JSON value `null`; otherwise returns `false`.

### JsonObject.IsNullOf

`Chilkat 11.7.0 · js · JsonObject · IsNullOf · method · since 9.5.0.56`

```javascript
var boolVal = IsNullOf(jsonPath);
```

· return: `boolean`  
· jsonPath: `string`

Returns `true` if the value at `jsonPath` is the JSON literal `null`; otherwise returns `false`.

**Null is a value:** JSON `null` is different from a missing member and from an empty string. Use `HasMember` when existence must be tested separately.

### JsonObject.JsonTypeOf

`Chilkat 11.7.0 · js · JsonObject · JsonTypeOf · method · since 9.5.0.68`

```javascript
var intVal = JsonTypeOf(jsonPath);
```

· return: `int`  
· jsonPath: `string`

Returns an integer identifying the JSON type of the value at `jsonPath`. Returns `-1` if no member exists at that path.

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

### JsonObject.Load

`Chilkat 11.7.0 · js · JsonObject · Load · method · since 9.5.0.56`

```javascript
var success = Load(json);
```

· return: `boolean`; `true` for success, `false` for failure  
· json: `string`

Parses the JSON text in `json` and loads the parsed data into this object for DOM-style access and modification.

**JSON data model:** JSON values are strings, numbers, booleans, `null`, objects, or arrays. Object member names should be unique for interoperable JSON; RFC 8259 notes that consumers differ in how duplicate names are handled.

Returns true for success, false for failure.

### JsonObject.LoadBd

`Chilkat 11.7.0 · js · JsonObject · LoadBd · method · since 9.5.0.77`

```javascript
var success = LoadBd(bd);
```

· return: `boolean`; `true` for success, `false` for failure  
· bd: `CkBinData`

Parses JSON from the bytes contained in `bd` and loads it into this object.

Returns true for success, false for failure.

### JsonObject.LoadFile

`Chilkat 11.7.0 · js · JsonObject · LoadFile · method · since 9.5.0.56`

```javascript
var success = LoadFile(path);
```

· return: `boolean`; `true` for success, `false` for failure  
· path: `string`

Reads JSON text from the file at `path`, parses it, and loads the result into this object.

Returns true for success, false for failure.

### JsonObject.LoadPredefined

`Chilkat 11.7.0 · js · JsonObject · LoadPredefined · method · since 9.5.0.67`

```javascript
var success = LoadPredefined(name);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`

Loads this object from the predefined JSON document identified by `name`. Predefined documents are created with `Predefine`.

Returns true for success, false for failure.

### JsonObject.LoadSb

`Chilkat 11.7.0 · js · JsonObject · LoadSb · method · since 9.5.0.62`

```javascript
var success = LoadSb(sb);
```

· return: `boolean`; `true` for success, `false` for failure  
· sb: `CkStringBuilder`

Parses JSON from the current contents of `sb` and loads it into this object.

Returns true for success, false for failure.

### JsonObject.MakeCopy

`Chilkat 11.7.0 · js · JsonObject · MakeCopy · method · since 11.0.0`

```javascript
var success = MakeCopy(json);
```

· return: `boolean`; `true` for success, `false` for failure  
· json: `CkJsonObject`

Copies this JSON object into `json`. The destination receives an independent JSON copy rather than another reference to the same underlying object.

**Copy vs. reference:** Use `CopyRef` when two `JsonObject` instances should refer to the same JSON object instead of duplicating its data.

Returns true for success, false for failure.

### JsonObject.MoveMember

`Chilkat 11.7.0 · js · JsonObject · MoveMember · method · since 9.5.0.80`

```javascript
var success = MoveMember(fromIndex, toIndex);
```

· return: `boolean`; `true` for success, `false` for failure  
· fromIndex: `int`  
· toIndex: `int`

Moves the direct member at zero-based position `fromIndex` to `toIndex`. Use `toIndex = 0` to move it first or `-1` to move it last.

Returns true for success, false for failure.

### JsonObject.NameAt

`Chilkat 11.7.0 · js · JsonObject · NameAt · method · since 9.5.0.56`

```javascript
var strVal = NameAt(index);
```

· return: `string`  
· index: `int`

Returns the name of the member at zero-based position `index`. Use this with `Size` and `TypeAt` to iterate through an object's direct members.

Returns `null` on failure

### JsonObject.NewArrayOf

`Chilkat 11.7.0 · js · JsonObject · NewArrayOf · method · since 11.4.0`

```javascript
var success = NewArrayOf(path, jArr);
```

· return: `boolean`; `true` for success, `false` for failure  
· path: `string`  
· jArr: `string`

Creates a JSON array at `path` and loads that array from the JSON text in `jArr`. The supplied text should represent a JSON array.

**Difference from UpdateNewArray:** `UpdateNewArray` creates an empty array. `NewArrayOf` creates the array and immediately populates it from JSON text.

Returns true for success, false for failure.

### JsonObject.NewObjectOf

`Chilkat 11.7.0 · js · JsonObject · NewObjectOf · method · since 11.4.0`

```javascript
var success = NewObjectOf(path, jObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· path: `string`  
· jObj: `string`

Creates a JSON object at `path` and loads that object from the JSON text in `jObj`. The supplied text should represent a JSON object.

**Difference from UpdateNewObject:** `UpdateNewObject` creates an empty object. `NewObjectOf` creates the object and immediately populates it from JSON text.

Returns true for success, false for failure.

### JsonObject.ObjectAt2

`Chilkat 11.7.0 · js · JsonObject · ObjectAt2 · method · since 11.0.0`

```javascript
var success = ObjectAt2(index, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· jsonObj: `CkJsonObject`

Updates `jsonObj` to reference the JSON object stored at zero-based member position `index` and returns `true` on success.

Returns true for success, false for failure.

### JsonObject.ObjectOf2

`Chilkat 11.7.0 · js · JsonObject · ObjectOf2 · method · since 11.0.0`

```javascript
var success = ObjectOf2(jsonPath, jsonObj);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· jsonObj: `CkJsonObject`

Updates `jsonObj` to reference the JSON object at `jsonPath` and returns `true` on success.

Returns true for success, false for failure.

### JsonObject.Predefine

`Chilkat 11.7.0 · js · JsonObject · Predefine · method · since 9.5.0.67`

```javascript
var success = Predefine(name);
```

· return: `boolean`; `true` for success, `false` for failure  
· name: `string`

Stores this JSON document in Chilkat's internal global collection of predefined JSON documents under `name`. If the name already exists, the predefined value is replaced.

**Template use:** After predefining a document, another `JsonObject` can load it by name with `LoadPredefined`.

Returns true for success, false for failure.

### JsonObject.Rename

`Chilkat 11.7.0 · js · JsonObject · Rename · method · since 9.5.0.56`

```javascript
var success = Rename(oldName, newName);
```

· return: `boolean`; `true` for success, `false` for failure  
· oldName: `string`  
· newName: `string`

Renames the direct member `oldName` to `newName`. The member value and its position are otherwise unchanged.

**JSON interoperability:** JSON object member names should be unique. Avoid renaming a member to a name already used by another member unless duplicate names are intentionally required.

Returns true for success, false for failure.

### JsonObject.RenameAt

`Chilkat 11.7.0 · js · JsonObject · RenameAt · method · since 9.5.0.56`

```javascript
var success = RenameAt(index, name);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· name: `string`

Renames the member at zero-based position `index` to `name`. The member value is not changed.

Returns true for success, false for failure.

### JsonObject.SetBoolAt

`Chilkat 11.7.0 · js · JsonObject · SetBoolAt · method · since 9.5.0.56`

```javascript
var success = SetBoolAt(index, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· value: `boolean`

Sets the member at zero-based position `index` to a JSON boolean value.

Returns true for success, false for failure.

### JsonObject.SetBoolOf

`Chilkat 11.7.0 · js · JsonObject · SetBoolOf · method · since 9.5.0.56`

```javascript
var success = SetBoolOf(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `boolean`

Sets the value at `jsonPath` to a JSON boolean value.

**Set vs. Update:** Use `UpdateBool` when missing objects or array positions along the path should be created automatically.

Returns true for success, false for failure.

### JsonObject.SetIntAt

`Chilkat 11.7.0 · js · JsonObject · SetIntAt · method · since 9.5.0.56`

```javascript
var success = SetIntAt(index, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· value: `int`

Sets the member at zero-based position `index` to a JSON number value. The integer is emitted as a JSON number.

Returns true for success, false for failure.

### JsonObject.SetIntOf

`Chilkat 11.7.0 · js · JsonObject · SetIntOf · method · since 9.5.0.56`

```javascript
var success = SetIntOf(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `int`

Sets the value at `jsonPath` to an integer JSON number.

**Set vs. Update:** Use `UpdateInt` when missing objects or array positions along the path should be created automatically.

Returns true for success, false for failure.

### JsonObject.SetNullAt

`Chilkat 11.7.0 · js · JsonObject · SetNullAt · method · since 9.5.0.56`

```javascript
var success = SetNullAt(index);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`

Sets the member at zero-based position `index` to a JSON null value.

Returns true for success, false for failure.

### JsonObject.SetNullOf

`Chilkat 11.7.0 · js · JsonObject · SetNullOf · method · since 9.5.0.56`

```javascript
var success = SetNullOf(jsonPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`

Sets the value at `jsonPath` to a JSON null value.

**Set vs. Update:** Use `UpdateNull` when missing objects or array positions along the path should be created automatically.

Returns true for success, false for failure.

### JsonObject.SetNumberAt

`Chilkat 11.7.0 · js · JsonObject · SetNumberAt · method · since 9.5.0.56`

```javascript
var success = SetNumberAt(index, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· value: `string`

Sets the member at zero-based position `index` to a JSON number value. The `value` argument is the exact textual representation of the JSON number.

**JSON number syntax:** The text may contain an integer, fraction, or exponent. It must be valid JSON number syntax; leading zeros (except for zero itself), `NaN`, and infinity are not valid JSON numbers.

Returns true for success, false for failure.

### JsonObject.SetNumberOf

`Chilkat 11.7.0 · js · JsonObject · SetNumberOf · method · since 9.5.0.56`

```javascript
var success = SetNumberOf(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `string`

Sets the value at `jsonPath` to a JSON number value. The `value` argument supplies the exact textual form of the JSON number.

**Set vs. Update:** Use `UpdateNumber` when missing objects or array positions along the path should be created automatically.

**Precision:** Using numeric text avoids an intermediate conversion through a floating-point type and can therefore preserve large integers or application-specific decimal formatting.

Returns true for success, false for failure.

### JsonObject.SetStringAt

`Chilkat 11.7.0 · js · JsonObject · SetStringAt · method · since 9.5.0.56`

```javascript
var success = SetStringAt(index, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· index: `int`  
· value: `string`

Sets the member at zero-based position `index` to a JSON string value. The string is escaped as required when JSON is emitted.

Returns true for success, false for failure.

### JsonObject.SetStringOf

`Chilkat 11.7.0 · js · JsonObject · SetStringOf · method · since 9.5.0.56`

```javascript
var success = SetStringOf(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `string`

Sets the value at `jsonPath` to a JSON string value. The string is escaped as required when JSON is emitted.

**Set vs. Update:** Use `UpdateString` when missing objects or array positions along the path should be created automatically.

Returns true for success, false for failure.

### JsonObject.SizeOfArray

`Chilkat 11.7.0 · js · JsonObject · SizeOfArray · method · since 9.5.0.56`

```javascript
var intVal = SizeOfArray(jsonPath);
```

· return: `int`  
· jsonPath: `string`

Returns the number of elements in the JSON array at `jsonPath`. Returns `-1` if the path does not resolve to an existing JSON array.

### JsonObject.Sort

`Chilkat 11.7.0 · js · JsonObject · Sort · method · since 9.5.0.100`

```javascript
Sort(ascending, caseSensitive);
```

· return: `undefined`  
· ascending: `boolean`  
· caseSensitive: `boolean`

Sorts this object's direct members by member name. `ascending` selects ascending or descending order, and `caseSensitive` controls how names are compared.

**JSON semantics:** Member ordering is not significant to JSON consumers, but sorting can make emitted JSON deterministic and easier to compare or review.

### JsonObject.StringAt

`Chilkat 11.7.0 · js · JsonObject · StringAt · method · since 9.5.0.56`

```javascript
var strVal = StringAt(index);
```

· return: `string`  
· index: `int`

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

**Indexing:** Member indexes are based on the order maintained by this `JsonObject` instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.

**Non-string values:** `StringOf` can also provide textual representations of scalar JSON values such as numbers, booleans, and `null`; use the type-specific methods when the JSON type itself matters.

Returns `null` on failure

### JsonObject.StringOf

`Chilkat 11.7.0 · js · JsonObject · StringOf · method · since 9.5.0.56`

```javascript
var strVal = StringOf(jsonPath);
```

· return: `string`  
· jsonPath: `string`

Returns the value at `jsonPath` as text. For a JSON string, the string value is returned. Scalar non-string values such as numbers, booleans, and `null` are returned using their JSON textual representation.

**Type-sensitive code:** Use `JsonTypeOf`, `IntOf`, `BoolOf`, or `IsNullOf` when the distinction between JSON types is important.

Returns `null` on failure

### JsonObject.StringOfEquals

`Chilkat 11.7.0 · js · JsonObject · StringOfEquals · method · since 9.5.0.96`

```javascript
var boolVal = StringOfEquals(jsonPath, value, caseSensitive);
```

· return: `boolean`  
· jsonPath: `string`  
· value: `string`  
· caseSensitive: `boolean`

Returns `true` if the textual value at `jsonPath` equals `value` according to the `caseSensitive` setting; otherwise returns `false`.

### JsonObject.StringOfSb

`Chilkat 11.7.0 · js · JsonObject · StringOfSb · method · since 9.5.0.68`

```javascript
var success = StringOfSb(jsonPath, sb);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· sb: `CkStringBuilder`

Retrieves the value at `jsonPath` as text and appends it to `sb`.

**Append behavior:** Existing contents of the destination `StringBuilder` are preserved.

Returns true for success, false for failure.

### JsonObject.Swap

`Chilkat 11.7.0 · js · JsonObject · Swap · method · since 9.5.0.76`

```javascript
var success = Swap(index1, index2);
```

· return: `boolean`; `true` for success, `false` for failure  
· index1: `int`  
· index2: `int`

Swaps the positions of the direct members at zero-based indexes `index1` and `index2`. Member names and values are unchanged.

**Ordering:** JSON object order is not semantically significant, but Chilkat preserves an order for index-based access and emission.

Returns true for success, false for failure.

### JsonObject.TypeAt

`Chilkat 11.7.0 · js · JsonObject · TypeAt · method · since 9.5.0.58`

```javascript
var intVal = TypeAt(index);
```

· return: `int`  
· index: `int`

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

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

### JsonObject.UIntOf

`Chilkat 11.7.0 · js · JsonObject · UIntOf · method · since 9.5.0.96`

```javascript
var uintVal = UIntOf(jsonPath);
```

· return: `unsigned int`  
· jsonPath: `string`

Returns the unsigned integer value at `jsonPath`.

### JsonObject.UpdateBd

`Chilkat 11.7.0 · js · JsonObject · UpdateBd · method · since 9.5.0.68`

```javascript
var success = UpdateBd(jsonPath, encoding, bd);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· encoding: `string`  
· bd: `CkBinData`

Updates the value at `jsonPath` to a JSON string value, or creates the member and any missing path components as needed. The bytes in `bd` are first encoded according to `encoding` (for example, `base64` or `hex`) and the encoded text is stored as the JSON string value.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

**Binary data in JSON:** JSON has no native byte-array type. Binary content must therefore be represented using a textual encoding agreed upon by the producer and consumer.

Returns true for success, false for failure.

### JsonObject.UpdateBool

`Chilkat 11.7.0 · js · JsonObject · UpdateBool · method · since 9.5.0.63`

```javascript
var success = UpdateBool(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `boolean`

Updates the value at `jsonPath` to a JSON boolean value, or creates the member and any missing path components as needed.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

Returns true for success, false for failure.

### JsonObject.UpdateInt

`Chilkat 11.7.0 · js · JsonObject · UpdateInt · method · since 9.5.0.63`

```javascript
var success = UpdateInt(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `int`

Updates the value at `jsonPath` to a JSON number value, or creates the member and any missing path components as needed. The integer value is stored as a JSON number.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

Returns true for success, false for failure.

### JsonObject.UpdateNewArray

`Chilkat 11.7.0 · js · JsonObject · UpdateNewArray · method · since 9.5.0.75`

```javascript
var success = UpdateNewArray(jsonPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`

Creates or replaces the value at `jsonPath` with a new empty JSON array. Missing path components are created automatically as needed.

Returns true for success, false for failure.

### JsonObject.UpdateNewObject

`Chilkat 11.7.0 · js · JsonObject · UpdateNewObject · method · since 9.5.0.75`

```javascript
var success = UpdateNewObject(jsonPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`

Creates or replaces the value at `jsonPath` with a new empty JSON object. Missing path components are created automatically as needed.

Returns true for success, false for failure.

### JsonObject.UpdateNull

`Chilkat 11.7.0 · js · JsonObject · UpdateNull · method · since 9.5.0.65`

```javascript
var success = UpdateNull(jsonPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`

Updates the value at `jsonPath` to a JSON null value, or creates the member and any missing path components as needed.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

Returns true for success, false for failure.

### JsonObject.UpdateNumber

`Chilkat 11.7.0 · js · JsonObject · UpdateNumber · method · since 9.5.0.65`

```javascript
var success = UpdateNumber(jsonPath, numericStr);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· numericStr: `string`

Updates the value at `jsonPath` to a JSON number value, or creates the member and any missing path components as needed. The `numericStr` argument is stored as the exact textual representation of the JSON number.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

**When to use:** Use `UpdateNumber` instead of `UpdateInt` for decimal/exponent forms, very large integers, or when preserving exact numeric text is important.

Returns true for success, false for failure.

### JsonObject.UpdateSb

`Chilkat 11.7.0 · js · JsonObject · UpdateSb · method · since 9.5.0.68`

```javascript
var success = UpdateSb(jsonPath, sb);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· sb: `CkStringBuilder`

Updates the value at `jsonPath` to a JSON string value, or creates the member and any missing path components as needed. The new string value is taken from the contents of `sb`.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

Returns true for success, false for failure.

### JsonObject.UpdateString

`Chilkat 11.7.0 · js · JsonObject · UpdateString · method · since 9.5.0.63`

```javascript
var success = UpdateString(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `string`

Updates the value at `jsonPath` to a JSON string value, or creates the member and any missing path components as needed. The supplied string is JSON-escaped as needed.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

**Version note:** Chilkat versions prior to 9.5.0.68 did not correctly escape all characters for this method. Version 9.5.0.68 and later correct that behavior.

Returns true for success, false for failure.

### JsonObject.UpdateUInt

`Chilkat 11.7.0 · js · JsonObject · UpdateUInt · method · since 9.5.0.96`

```javascript
var success = UpdateUInt(jsonPath, value);
```

· return: `boolean`; `true` for success, `false` for failure  
· jsonPath: `string`  
· value: `unsigned int`

Updates the value at `jsonPath` to a JSON number value, or creates the member and any missing path components as needed. The unsigned integer is stored as a JSON number.

**Path-based operation:** `jsonPath` is interpreted using `DelimiterChar`, `PathPrefix`, and the `I`/`J`/`K` index substitutions.

Returns true for success, false for failure.

### JsonObject.WriteFile

`Chilkat 11.7.0 · js · JsonObject · WriteFile · method · since 9.5.0.76`

```javascript
var success = WriteFile(path);
```

· return: `boolean`; `true` for success, `false` for failure  
· path: `string`

Serializes this JSON and writes it to the file at `path`. Output formatting follows `EmitCompact` and `EmitCrLf`.

Returns true for success, false for failure.

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/BinData.md), [`CkDateTime`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/CkDateTime.md), [`DtObj`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/DtObj.md), [`Hashtable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/Hashtable.md), [`JsonArray`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/JsonArray.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/StringBuilder.md), [`StringTable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/StringTable.md)

