JsonObject C Reference Documentation

JsonObject

Current Version: 11.5.0

Chilkat.JsonObject

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.

Create/Dispose

HCkJsonObject instance = CkJsonObject_Create();
// ...
CkJsonObject_Dispose(instance);
HCkJsonObject CkJsonObject_Create(void);

Creates an instance of the HCkJsonObject object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkJsonObject_Dispose(HCkJsonObject handle);

Objects created by calling CkJsonObject_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkJsonObject_Dispose.

Properties

DebugLogFilePath
void CkJsonObject_getDebugLogFilePath(HCkJsonObject cHandle, HCkString retval);
void CkJsonObject_putDebugLogFilePath(HCkJsonObject cHandle, const char *newVal);
const char *CkJsonObject_debugLogFilePath(HCkJsonObject cHandle);

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

More Information and Examples
top
DelimiterChar
void CkJsonObject_getDelimiterChar(HCkJsonObject cHandle, HCkString retval);
void CkJsonObject_putDelimiterChar(HCkJsonObject cHandle, const char *newVal);
const char *CkJsonObject_delimiterChar(HCkJsonObject cHandle);
Introduced in version 9.5.0.58

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.

top
EmitCompact
BOOL CkJsonObject_getEmitCompact(HCkJsonObject cHandle);
void CkJsonObject_putEmitCompact(HCkJsonObject cHandle, BOOL newVal);
Introduced in version 9.5.0.56

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

TRUEEmit a compact representation with no extra formatting whitespace.
FALSEEmit 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.

top
EmitCrLf
BOOL CkJsonObject_getEmitCrLf(HCkJsonObject cHandle);
void CkJsonObject_putEmitCrLf(HCkJsonObject cHandle, BOOL newVal);
Introduced in version 9.5.0.56

Controls line endings when pretty-printed JSON is emitted (EmitCompact = FALSE). The default is TRUE.

TRUEUse CRLF line endings.
FALSEUse LF line endings.
Compact output: This setting has no effect when EmitCompact is TRUE because compact JSON is emitted without formatting line breaks.

top
EnableSecrets
BOOL CkJsonObject_getEnableSecrets(HCkJsonObject cHandle);
void CkJsonObject_putEnableSecrets(HCkJsonObject cHandle, BOOL newVal);
Introduced in version 11.5.0

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.

More Information and Examples
top
I
int CkJsonObject_getI(HCkJsonObject cHandle);
void CkJsonObject_putI(HCkJsonObject cHandle, int newVal);
Introduced in version 9.5.0.56

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

More Information and Examples
top
J
int CkJsonObject_getJ(HCkJsonObject cHandle);
void CkJsonObject_putJ(HCkJsonObject cHandle, int newVal);
Introduced in version 9.5.0.56

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

top
K
int CkJsonObject_getK(HCkJsonObject cHandle);
void CkJsonObject_putK(HCkJsonObject cHandle, int newVal);
Introduced in version 9.5.0.56

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.

top
LastErrorHtml
void CkJsonObject_getLastErrorHtml(HCkJsonObject cHandle, HCkString retval);
const char *CkJsonObject_lastErrorHtml(HCkJsonObject cHandle);

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorText
void CkJsonObject_getLastErrorText(HCkJsonObject cHandle, HCkString retval);
const char *CkJsonObject_lastErrorText(HCkJsonObject cHandle);

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorXml
void CkJsonObject_getLastErrorXml(HCkJsonObject cHandle, HCkString retval);
const char *CkJsonObject_lastErrorXml(HCkJsonObject cHandle);

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastMethodSuccess
BOOL CkJsonObject_getLastMethodSuccess(HCkJsonObject cHandle);
void CkJsonObject_putLastMethodSuccess(HCkJsonObject cHandle, BOOL newVal);

Indicates the success or failure of the most recent method call: TRUE means success, FALSE means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.

top
LowerCaseNames
BOOL CkJsonObject_getLowerCaseNames(HCkJsonObject cHandle);
void CkJsonObject_putLowerCaseNames(HCkJsonObject cHandle, BOOL newVal);
Introduced in version 9.5.0.87

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.

top
PathPrefix
void CkJsonObject_getPathPrefix(HCkJsonObject cHandle, HCkString retval);
void CkJsonObject_putPathPrefix(HCkJsonObject cHandle, const char *newVal);
const char *CkJsonObject_pathPrefix(HCkJsonObject cHandle);
Introduced in version 9.5.0.76

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.

More Information and Examples
top
Size
int CkJsonObject_getSize(HCkJsonObject cHandle);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
UncommonOptions
void CkJsonObject_getUncommonOptions(HCkJsonObject cHandle, HCkString retval);
void CkJsonObject_putUncommonOptions(HCkJsonObject cHandle, const char *newVal);
const char *CkJsonObject_uncommonOptions(HCkJsonObject cHandle);
Introduced in version 9.5.0.90

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.

top
Utf8
BOOL CkJsonObject_getUtf8(HCkJsonObject cHandle);
void CkJsonObject_putUtf8(HCkJsonObject cHandle, BOOL newVal);

When set to TRUE, all const char * arguments and return values are interpreted as UTF-8 strings. When set to FALSE, they are interpreted as ANSI strings.

In Chilkat v11.0.0 and later, the default value is TRUE. Before v11.0.0, it was FALSE.

top
VerboseLogging
BOOL CkJsonObject_getVerboseLogging(HCkJsonObject cHandle);
void CkJsonObject_putVerboseLogging(HCkJsonObject cHandle, BOOL newVal);

If set to TRUE, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is FALSE. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
void CkJsonObject_getVersion(HCkJsonObject cHandle, HCkString retval);
const char *CkJsonObject_version(HCkJsonObject cHandle);

Version of the component/library, such as "10.1.0"

More Information and Examples
top

Methods

AddArrayAt
BOOL CkJsonObject_AddArrayAt(HCkJsonObject cHandle, int index, const char *name);
Introduced in version 9.5.0.56

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

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddArrayCopyAt
BOOL CkJsonObject_AddArrayCopyAt(HCkJsonObject cHandle, int index, const char *name, HCkJsonArray jarr);
Introduced in version 9.5.0.82

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.

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddBoolAt
BOOL CkJsonObject_AddBoolAt(HCkJsonObject cHandle, int index, const char *name, BOOL value);
Introduced in version 9.5.0.56

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

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddIntAt
BOOL CkJsonObject_AddIntAt(HCkJsonObject cHandle, int index, const char *name, int value);
Introduced in version 9.5.0.56

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.

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddNullAt
BOOL CkJsonObject_AddNullAt(HCkJsonObject cHandle, int index, const char *name);
Introduced in version 9.5.0.56

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

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddNumberAt
BOOL CkJsonObject_AddNumberAt(HCkJsonObject cHandle, int index, const char *name, const char *numericStr);
Introduced in version 9.5.0.56

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.

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddObjectAt
BOOL CkJsonObject_AddObjectAt(HCkJsonObject cHandle, int index, const char *name);
Introduced in version 9.5.0.56

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

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddObjectCopyAt
BOOL CkJsonObject_AddObjectCopyAt(HCkJsonObject cHandle, int index, const char *name, HCkJsonObject jsonObj);
Introduced in version 9.5.0.82

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.

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AddStringAt
BOOL CkJsonObject_AddStringAt(HCkJsonObject cHandle, int index, const char *name, const char *value);
Introduced in version 9.5.0.56

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.

0Insert as the first member.
-1Append as the last member.
nInsert 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.

More Information and Examples
top
AppendArray
HCkJsonArray CkJsonObject_AppendArray(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.58

Appends a new JSON array member named name to this object. The newly appended array is empty and the returned JsonArray references that array in this document, so changes made through it modify the same JSON tree.

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 NULL on failure

More Information and Examples
top
AppendArray2
BOOL CkJsonObject_AppendArray2(HCkJsonObject cHandle, const char *name, HCkJsonArray jarr);
Introduced in version 11.0.0

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.

top
AppendArrayCopy
BOOL CkJsonObject_AppendArrayCopy(HCkJsonObject cHandle, const char *name, HCkJsonArray jarr);
Introduced in version 9.5.0.82

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.

More Information and Examples
top
AppendBool
BOOL CkJsonObject_AppendBool(HCkJsonObject cHandle, const char *name, BOOL value);
Introduced in version 9.5.0.58

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.

top
AppendInt
BOOL CkJsonObject_AppendInt(HCkJsonObject cHandle, const char *name, int value);
Introduced in version 9.5.0.58

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.

top
AppendObject
HCkJsonObject CkJsonObject_AppendObject(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.58

Appends a new JSON object member named name to this object. The newly appended object is empty and the returned JsonObject references that object in this document.

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 NULL on failure

More Information and Examples
top
AppendObject2
BOOL CkJsonObject_AppendObject2(HCkJsonObject cHandle, const char *name, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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.

top
AppendObjectCopy
BOOL CkJsonObject_AppendObjectCopy(HCkJsonObject cHandle, const char *name, HCkJsonObject jsonObj);
Introduced in version 9.5.0.82

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.

More Information and Examples
top
AppendString
BOOL CkJsonObject_AppendString(HCkJsonObject cHandle, const char *name, const char *value);
Introduced in version 9.5.0.58

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.

top
AppendStringArray
BOOL CkJsonObject_AppendStringArray(HCkJsonObject cHandle, const char *name, HCkStringTable values);
Introduced in version 9.5.0.67

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.

More Information and Examples
top
ArrayAt
HCkJsonArray CkJsonObject_ArrayAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

Returns the JSON array stored in the member at zero-based position index. The returned JsonArray references the existing array in the same document; it is not a detached copy.

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

Returns NULL on failure

More Information and Examples
top
ArrayAt2
BOOL CkJsonObject_ArrayAt2(HCkJsonObject cHandle, int index, HCkJsonArray jarr);
Introduced in version 11.0.0

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.

top
ArrayOf
HCkJsonArray CkJsonObject_ArrayOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

Returns the JSON array at jsonPath. The returned JsonArray references the existing array in the same document, so modifications through it are reflected in the parent JSON.

JSON paths: Paths are relative to this object and may include object-member separators and array indexes, for example orders[0].items.

Returns NULL on failure

top
ArrayOf2
BOOL CkJsonObject_ArrayOf2(HCkJsonObject cHandle, const char *jsonPath, HCkJsonArray jarr);
Introduced in version 11.1.0

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

Returns TRUE for success, FALSE for failure.

top
BoolAt
BOOL CkJsonObject_BoolAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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.
More Information and Examples
top
BoolOf
BOOL CkJsonObject_BoolOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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

More Information and Examples
top
BytesOf
BOOL CkJsonObject_BytesOf(HCkJsonObject cHandle, const char *jsonPath, const char *encoding, HCkBinData bd);
Introduced in version 9.5.0.68

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.

top
Clear
void CkJsonObject_Clear(HCkJsonObject cHandle);
Introduced in version 9.5.0.76

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

top
CopyRef
BOOL CkJsonObject_CopyRef(HCkJsonObject cHandle, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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.

top
DateOf
BOOL CkJsonObject_DateOf(HCkJsonObject cHandle, const char *jsonPath, HCkDateTime dateTime);
Introduced in version 9.5.0.73

Parses the date/time value at jsonPath and loads the result into dateTime. 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.

top
Delete
BOOL CkJsonObject_Delete(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
DeleteAt
BOOL CkJsonObject_DeleteAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
DeleteRecords
int CkJsonObject_DeleteRecords(HCkJsonObject cHandle, const char *arrayPath, const char *relpath, const char *value, BOOL caseSensitive);
Introduced in version 9.5.0.88

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.

top
DtOf
BOOL CkJsonObject_DtOf(HCkJsonObject cHandle, const char *jsonPath, BOOL bLocal, HCkDtObj dt);
Introduced in version 9.5.0.73

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.

More Information and Examples
top
Emit
BOOL CkJsonObject_Emit(HCkJsonObject cHandle, HCkString outStr);
const char *CkJsonObject_emit(HCkJsonObject cHandle);
Introduced in version 9.5.0.56

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 TRUE for success, FALSE for failure.

More Information and Examples
top
EmitBd
BOOL CkJsonObject_EmitBd(HCkJsonObject cHandle, HCkBinData bd);
Introduced in version 9.5.0.77

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.

top
EmitSb
BOOL CkJsonObject_EmitSb(HCkJsonObject cHandle, HCkStringBuilder sb);
Introduced in version 9.5.0.62

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.

top
EmitWithSubs
BOOL CkJsonObject_EmitWithSubs(HCkJsonObject cHandle, HCkHashtable subs, BOOL omitEmpty, HCkString outStr);
const char *CkJsonObject_emitWithSubs(HCkJsonObject cHandle, HCkHashtable subs, BOOL omitEmpty);
Introduced in version 9.5.0.67

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 TRUE for success, FALSE for failure.

More Information and Examples
top
FindObjectWithMember
HCkJsonObject CkJsonObject_FindObjectWithMember(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.67

Recursively searches this JSON subtree for the first JSON object containing a direct member named name. Returns that object, or NULL if no matching object is found.

Returns NULL on failure

top
FindObjectWithMember2
BOOL CkJsonObject_FindObjectWithMember2(HCkJsonObject cHandle, const char *name, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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.

top
FindRecord
HCkJsonObject CkJsonObject_FindRecord(HCkJsonObject cHandle, const char *arrayPath, const char *relPath, const char *value, BOOL caseSensitive);
Introduced in version 9.5.0.63

Searches the JSON array at arrayPath for the first object whose value at relative path relPath equals or wildcard-matches value. The caseSensitive argument controls string comparison. Returns the matching record object.

Wildcard matching: The search value may contain * to match zero or more characters. relPath is evaluated relative to each record object in the array.

Returns NULL on failure

More Information and Examples
top
FindRecord2
BOOL CkJsonObject_FindRecord2(HCkJsonObject cHandle, const char *arrayPath, const char *relPath, const char *value, BOOL caseSensitive, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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.

top
FindRecordString
BOOL CkJsonObject_FindRecordString(HCkJsonObject cHandle, const char *arrayPath, const char *relPath, const char *value, BOOL caseSensitive, const char *retRelPath, HCkString outStr);
const char *CkJsonObject_findRecordString(HCkJsonObject cHandle, const char *arrayPath, const char *relPath, const char *value, BOOL caseSensitive, const char *retRelPath);
Introduced in version 9.5.0.63

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 TRUE for success, FALSE for failure.

More Information and Examples
top
FirebaseApplyEvent
BOOL CkJsonObject_FirebaseApplyEvent(HCkJsonObject cHandle, const char *name, const char *data);
Introduced in version 9.5.0.58

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.

top
FirebasePatch
BOOL CkJsonObject_FirebasePatch(HCkJsonObject cHandle, const char *jsonPath, const char *jsonData);
Introduced in version 9.5.0.58

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.

More Information and Examples
top
FirebasePut
BOOL CkJsonObject_FirebasePut(HCkJsonObject cHandle, const char *jsonPath, const char *value);
Introduced in version 9.5.0.58

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.

More Information and Examples
top
GetDocRoot
HCkJsonObject CkJsonObject_GetDocRoot(HCkJsonObject cHandle);
Introduced in version 9.5.0.56

Returns a JsonObject reference to the root object of the JSON document containing this object. This can be called from any nested object reference.

Shared document lifetime: Nested JsonObject references share the same underlying JSON document. The document remains available while at least one such reference is retained by the application.

Returns NULL on failure

More Information and Examples
top
GetDocRoot2
BOOL CkJsonObject_GetDocRoot2(HCkJsonObject cHandle, HCkJsonObject docRoot);
Introduced in version 11.0.0

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.

top
HasMember
BOOL CkJsonObject_HasMember(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.58

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.

top
IndexOf
int CkJsonObject_IndexOf(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.56

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.
More Information and Examples
top
IntAt
int CkJsonObject_IntAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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.
More Information and Examples
top
IntOf
int CkJsonObject_IntOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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.
top
IsNullAt
BOOL CkJsonObject_IsNullAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

Returns TRUE if the member at zero-based position index has the JSON value null; otherwise returns FALSE.

More Information and Examples
top
IsNullOf
BOOL CkJsonObject_IsNullOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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.
More Information and Examples
top
JsonTypeOf
int CkJsonObject_JsonTypeOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.68

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

1string
2number
3object
4array
5boolean
6null
top
Load
BOOL CkJsonObject_Load(HCkJsonObject cHandle, const char *json);
Introduced in version 9.5.0.56

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.

top
LoadBd
BOOL CkJsonObject_LoadBd(HCkJsonObject cHandle, HCkBinData bd);
Introduced in version 9.5.0.77

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

Returns TRUE for success, FALSE for failure.

top
LoadFile
BOOL CkJsonObject_LoadFile(HCkJsonObject cHandle, const char *path);
Introduced in version 9.5.0.56

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
LoadPredefined
BOOL CkJsonObject_LoadPredefined(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.67

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
LoadSb
BOOL CkJsonObject_LoadSb(HCkJsonObject cHandle, HCkStringBuilder sb);
Introduced in version 9.5.0.62

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

Returns TRUE for success, FALSE for failure.

top
MakeCopy
BOOL CkJsonObject_MakeCopy(HCkJsonObject cHandle, HCkJsonObject json);
Introduced in version 11.0.0

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.

top
MoveMember
BOOL CkJsonObject_MoveMember(HCkJsonObject cHandle, int fromIndex, int toIndex);
Introduced in version 9.5.0.80

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.

top
NameAt
BOOL CkJsonObject_NameAt(HCkJsonObject cHandle, int index, HCkString outStr);
const char *CkJsonObject_nameAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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 TRUE for success, FALSE for failure.

More Information and Examples
top
NewArrayOf
BOOL CkJsonObject_NewArrayOf(HCkJsonObject cHandle, const char *path, const char *jArr);
Introduced in version 11.4.0

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.

More Information and Examples
top
NewObjectOf
BOOL CkJsonObject_NewObjectOf(HCkJsonObject cHandle, const char *path, const char *jObj);
Introduced in version 11.4.0

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.

More Information and Examples
top
ObjectAt
HCkJsonObject CkJsonObject_ObjectAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

Returns the JSON object stored in the member at zero-based position index. The returned JsonObject references the existing child object in the same document; changes made through it modify that document.

Type requirement: The member at index must be a JSON object. Use TypeAt when the type is not already known.

Returns NULL on failure

More Information and Examples
top
ObjectAt2
BOOL CkJsonObject_ObjectAt2(HCkJsonObject cHandle, int index, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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.

top
ObjectOf
HCkJsonObject CkJsonObject_ObjectOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

Returns the JSON object at jsonPath. The returned object is a live reference into the same JSON document, not a copy.

Relative paths: A path is evaluated relative to the current object. Use GetDocRoot when access must start from the document root.

Returns NULL on failure

More Information and Examples
top
ObjectOf2
BOOL CkJsonObject_ObjectOf2(HCkJsonObject cHandle, const char *jsonPath, HCkJsonObject jsonObj);
Introduced in version 11.0.0

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

Returns TRUE for success, FALSE for failure.

top
Predefine
BOOL CkJsonObject_Predefine(HCkJsonObject cHandle, const char *name);
Introduced in version 9.5.0.67

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.

More Information and Examples
top
Rename
BOOL CkJsonObject_Rename(HCkJsonObject cHandle, const char *oldName, const char *newName);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
RenameAt
BOOL CkJsonObject_RenameAt(HCkJsonObject cHandle, int index, const char *name);
Introduced in version 9.5.0.56

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SetBoolAt
BOOL CkJsonObject_SetBoolAt(HCkJsonObject cHandle, int index, BOOL value);
Introduced in version 9.5.0.56

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SetBoolOf
BOOL CkJsonObject_SetBoolOf(HCkJsonObject cHandle, const char *jsonPath, BOOL value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetIntAt
BOOL CkJsonObject_SetIntAt(HCkJsonObject cHandle, int index, int value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetIntOf
BOOL CkJsonObject_SetIntOf(HCkJsonObject cHandle, const char *jsonPath, int value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetNullAt
BOOL CkJsonObject_SetNullAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SetNullOf
BOOL CkJsonObject_SetNullOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetNumberAt
BOOL CkJsonObject_SetNumberAt(HCkJsonObject cHandle, int index, const char *value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetNumberOf
BOOL CkJsonObject_SetNumberOf(HCkJsonObject cHandle, const char *jsonPath, const char *value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetStringAt
BOOL CkJsonObject_SetStringAt(HCkJsonObject cHandle, int index, const char *value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SetStringOf
BOOL CkJsonObject_SetStringOf(HCkJsonObject cHandle, const char *jsonPath, const char *value);
Introduced in version 9.5.0.56

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.

More Information and Examples
top
SizeOfArray
int CkJsonObject_SizeOfArray(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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

More Information and Examples
top
Sort
void CkJsonObject_Sort(HCkJsonObject cHandle, BOOL ascending, BOOL caseSensitive);
Introduced in version 9.5.0.100

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.
More Information and Examples
top
StringAt
BOOL CkJsonObject_StringAt(HCkJsonObject cHandle, int index, HCkString outStr);
const char *CkJsonObject_stringAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.56

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 TRUE for success, FALSE for failure.

More Information and Examples
top
StringOf
BOOL CkJsonObject_StringOf(HCkJsonObject cHandle, const char *jsonPath, HCkString outStr);
const char *CkJsonObject_stringOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.56

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 TRUE for success, FALSE for failure.

top
StringOfEquals
BOOL CkJsonObject_StringOfEquals(HCkJsonObject cHandle, const char *jsonPath, const char *value, BOOL caseSensitive);
Introduced in version 9.5.0.96

Returns TRUE if the textual value at jsonPath equals value according to the caseSensitive setting; otherwise returns FALSE.

top
StringOfSb
BOOL CkJsonObject_StringOfSb(HCkJsonObject cHandle, const char *jsonPath, HCkStringBuilder sb);
Introduced in version 9.5.0.68

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.

top
Swap
BOOL CkJsonObject_Swap(HCkJsonObject cHandle, int index1, int index2);
Introduced in version 9.5.0.76

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.

More Information and Examples
top
TypeAt
int CkJsonObject_TypeAt(HCkJsonObject cHandle, int index);
Introduced in version 9.5.0.58

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

1string
2number
3object
4array
5boolean
6null
top
UIntOf
unsigned long CkJsonObject_UIntOf(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.96

Returns the unsigned integer value at jsonPath.

top
UpdateBd
BOOL CkJsonObject_UpdateBd(HCkJsonObject cHandle, const char *jsonPath, const char *encoding, HCkBinData bd);
Introduced in version 9.5.0.68

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.

top
UpdateBool
BOOL CkJsonObject_UpdateBool(HCkJsonObject cHandle, const char *jsonPath, BOOL value);
Introduced in version 9.5.0.63

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.

top
UpdateInt
BOOL CkJsonObject_UpdateInt(HCkJsonObject cHandle, const char *jsonPath, int value);
Introduced in version 9.5.0.63

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.

More Information and Examples
top
UpdateNewArray
BOOL CkJsonObject_UpdateNewArray(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.75

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.

More Information and Examples
top
UpdateNewObject
BOOL CkJsonObject_UpdateNewObject(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.75

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.

More Information and Examples
top
UpdateNull
BOOL CkJsonObject_UpdateNull(HCkJsonObject cHandle, const char *jsonPath);
Introduced in version 9.5.0.65

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.

top
UpdateNumber
BOOL CkJsonObject_UpdateNumber(HCkJsonObject cHandle, const char *jsonPath, const char *numericStr);
Introduced in version 9.5.0.65

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.

More Information and Examples
top
UpdateSb
BOOL CkJsonObject_UpdateSb(HCkJsonObject cHandle, const char *jsonPath, HCkStringBuilder sb);
Introduced in version 9.5.0.68

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.

top
UpdateString
BOOL CkJsonObject_UpdateString(HCkJsonObject cHandle, const char *jsonPath, const char *value);
Introduced in version 9.5.0.63

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.

More Information and Examples
top
UpdateUInt
BOOL CkJsonObject_UpdateUInt(HCkJsonObject cHandle, const char *jsonPath, unsigned long value);
Introduced in version 9.5.0.96

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.

top
WriteFile
BOOL CkJsonObject_WriteFile(HCkJsonObject cHandle, const char *path);
Introduced in version 9.5.0.76

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

Returns TRUE for success, FALSE for failure.

top

Deprecated

Clone
HCkJsonObject CkJsonObject_Clone(HCkJsonObject cHandle);
Introduced in version 9.5.0.66
This method is deprecated and replaced by MakeCopy

Deprecated. Use MakeCopy instead. Returns an independent copy of this JSON object.

Returns NULL on failure

top