JsonObject Chilkat2 Perl Reference Documentation
Chilkat2::JsonObject
Current Version: 11.7.0
Markdown version of this page for AI tools (v 11.7.0) · all AI docs
Chilkat.JsonObject
Load JSON from strings, files, buffers, or Chilkat objects, then emit the
result as compact or pretty-formatted JSON.
Read and update nested values using JSON paths, with support for
automatically creating missing object or array paths.
Access object members by name or index, inspect member types, retrieve
values, and remove or rename members as needed.
Work directly with child
Search records, sort object members, perform Firebase-style updates, and
prepare JSON for API requests or application storage.
Handle date/time values, binary data encodings, exact numeric text,
variable substitution, and secure secret resolution.
For an extended overview, see
JsonObject Class Overview.
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
Path-based navigation
Member access
Nested objects and arrays
JsonObject and
JsonArray references to navigate and modify complex JSON
structures.
Search and transform
Special value handling
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.
Object Creation
use Chilkat2;
my $json = Chilkat2::JsonObject->new;
# or set properties (and RaiseError) at creation:
# my $json = Chilkat2::JsonObject->new(VerboseLogging => 1, RaiseError => 1);Creates the object. The optional pairs set writable properties (and RaiseError) in order, as if set one by one; an unknown or read-only name croaks. use Chilkat2; loads every class; the Chilkat2/JsonObject.pm file holds only this class's documentation (perldoc Chilkat2::JsonObject).
Perl frees the object when its last reference goes (undef $json, or the variable going out of scope); there is nothing to close. Objects returned by methods are independent and freed the same way. The class may be subclassed (use parent -norequire, 'Chilkat2::JsonObject';): an object is a blessed hash reference whose hash is free for the subclass's own fields.
When false (the default), a method that fails returns false (or undef), and the reason is in LastErrorText. When true, it dies with a Chilkat2::Error instead, as DBI does with its RaiseError. Objects returned by a method inherit the value of the object that returned them.
Errors
A Chilkat2::Error stringifies to the failed call's full LastErrorText, and has the methods text, class ('Chilkat2::JsonObject'), method (the method name) and object. Methods that look something up and find nothing return undef without dying (each such method says so), methods that answer a question (HasMember, IsUnlocked, ...) return a plain boolean, and property reads and writes never fail for Chilkat reasons.
Misuse always croaks, with your file and line, whatever RaiseError is: a wrong number of arguments, a reference or undef where a string or number is expected, an object of the wrong class, an out-of-range integer, a string containing a NUL character, a wide character in a byte string, or a write to a read-only property.
Strings are Perl character strings in both directions (length, regexes and :encoding layers see characters); binary data (BinData) is a byte string. Unlocking: call Chilkat2::Global->new->UnlockBundle('...') once at startup.
Properties
DebugLogFilePath
my $strVal = $json->DebugLogFilePath;
$json->DebugLogFilePath($strVal);
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.
DelimiterChar
my $strVal = $json->DelimiterChar;
$json->DelimiterChar($strVal);
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.
orders[0].id. If a member name itself contains a path-separator character, quote that path component with double quotes.EmitCompact
my $boolVal = $json->EmitCompact;
$json->EmitCompact($boolVal);
Controls whether emitted JSON is compact or pretty-printed. The default is 1.
| Emit a compact representation with no extra formatting whitespace. |
| Emit indented, human-readable JSON. |
EmitCrLf
my $boolVal = $json->EmitCrLf;
$json->EmitCrLf($boolVal);
Controls line endings when pretty-printed JSON is emitted (EmitCompact = ). The default is 01.
| Use CRLF line endings. |
| Use LF line endings. |
EmitCompact is 1 because compact JSON is emitted without formatting line breaks.EnableSecrets
my $boolVal = $json->EnableSecrets;
$json->EnableSecrets($boolVal);
Enables automatic resolution of Chilkat secret specification strings for supported string-setting methods. The default is 0. 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.
I
my $intVal = $json->I;
$json->I($intVal);
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.
J and K properties provide the same substitution behavior for [j] and [k].J
my $intVal = $json->J;
$json->J($intVal);
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].
K
my $intVal = $json->K;
$json->K($intVal);
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.
LastErrorHtml
my $strVal = $json->LastErrorHtml;
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.
topLastErrorText
my $strVal = $json->LastErrorText;
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.
LastErrorXml
my $strVal = $json->LastErrorXml;
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.
topLastMethodSuccess
my $boolVal = $json->LastMethodSuccess;
$json->LastMethodSuccess($boolVal);
Indicates the success or failure of the most recent method call: 1 means success, 0 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.
LowerCaseNames
my $boolVal = $json->LowerCaseNames;
$json->LowerCaseNames($boolVal);
If 1, member names are converted to lowercase while JSON is loaded by Load, LoadBd, LoadSb, or LoadFile. The default is 0.
PathPrefix
my $strVal = $json->PathPrefix;
$json->PathPrefix($strVal);
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.
Size
my $intVal = $json->Size;
Returns the number of direct name/value members in this JSON object. Nested members inside child objects are not included.
Strict
my $boolVal = $json->Strict;
$json->Strict($boolVal);
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 0.
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 1 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.
0 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.UncommonOptions
my $strVal = $json->UncommonOptions;
$json->UncommonOptions($strVal);
Provides a catch-all string for uncommon, implementation-specific options. The default is the empty string and it should normally remain empty.
JsonObject option is documented by Chilkat or provided by Chilkat support.VerboseLogging
my $boolVal = $json->VerboseLogging;
$json->VerboseLogging($boolVal);
If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.
Version
my $strVal = $json->Version;
Methods
AddArrayAt
# $name is a string
# $success is true or false
my $success = $json->AddArrayAt($index, $name);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddArrayCopyAt
# $name is a string
# $jarr is a Chilkat2::JsonArray
# $success is true or false
my $success = $json->AddArrayCopyAt($index, $name, $jarr);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddBoolAt
# $name is a string
# $value is a boolean
# $success is true or false
my $success = $json->AddBoolAt($index, $name, $value);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddIntAt
# $name is a string
# $value is an integer
# $success is true or false
my $success = $json->AddIntAt($index, $name, $value);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddNullAt
# $name is a string
# $success is true or false
my $success = $json->AddNullAt($index, $name);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddNumberAt
# $name is a string
# $numericStr is a string
# $success is true or false
my $success = $json->AddNumberAt($index, $name, $numericStr);
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. |
name is a direct member name, not a JSON path. Use an Update* or Set*Of method when addressing a nested value by path.12345678901234567890, 1.2500, or scientific notation. The supplied text must be valid JSON number syntax; JSON does not permit NaN or infinity.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddObjectAt
# $name is a string
# $success is true or false
my $success = $json->AddObjectAt($index, $name);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddObjectCopyAt
# $name is a string
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->AddObjectCopyAt($index, $name, $jsonObj);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AddStringAt
# $name is a string
# $value is a string
# $success is true or false
my $success = $json->AddStringAt($index, $name, $value);
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. |
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendArray
# $jsonArray is a Chilkat2::JsonArray or undef
my $jsonArray = $json->AppendArray($name);
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.
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 undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way. The returned object is new and independent of this one, and inherits its RaiseError.
AppendArray2
# $jarr is a Chilkat2::JsonArray
# $success is true or false
my $success = $json->AppendArray2($name, $jarr);
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 1 on success.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendArrayCopy
# $jarr is a Chilkat2::JsonArray
# $success is true or false
my $success = $json->AppendArrayCopy($name, $jarr);
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.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendBool
# $value is a boolean
# $success is true or false
my $success = $json->AppendBool($name, $value);
Appends a new JSON boolean member named name to this object. The value is taken from value.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendInt
# $value is an integer
# $success is true or false
my $success = $json->AppendInt($name, $value);
Appends a new JSON number member named name to this object. The integer value is stored as a JSON number.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendObject
# $jsonObject is a Chilkat2::JsonObject or undef
my $jsonObject = $json->AppendObject($name);
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.
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 undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way. The returned object is new and independent of this one, and inherits its RaiseError.
AppendObject2
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->AppendObject2($name, $jsonObj);
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 1 on success.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendObjectCopy
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->AppendObjectCopy($name, $jsonObj);
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.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendString
# $value is a string
# $success is true or false
my $success = $json->AppendString($name, $value);
Appends a new JSON string member named name to this object. The value is JSON-escaped as needed when emitted.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
AppendStringArray
# $values is a Chilkat2::StringTable
# $success is true or false
my $success = $json->AppendStringArray($name, $values);
Appends a new JSON array member named name to this object. The array is populated with the strings contained in values.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ArrayAt
# $jsonArray is a Chilkat2::JsonArray or undef
my $jsonArray = $json->ArrayAt($index);
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.
index must be an array. Use TypeAt when the member type is not already known.Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way. The returned object is new and independent of this one, and inherits its RaiseError.
ArrayAt2
# $jarr is a Chilkat2::JsonArray
# $success is true or false
my $success = $json->ArrayAt2($index, $jarr);
Updates jarr to reference the JSON array stored at zero-based member position index and returns 1 on success.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ArrayOf
# $jsonArray is a Chilkat2::JsonArray or undef
my $jsonArray = $json->ArrayOf($jsonPath);
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.
orders[0].items.Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is. The returned object is new and independent of this one, and inherits its RaiseError.
ArrayOf2
# $jarr is a Chilkat2::JsonArray
# $success is true or false
my $success = $json->ArrayOf2($jsonPath, $jarr);
Updates jarr to reference the JSON array at jsonPath and returns 1 on success.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
BoolAt
# $flag is true or false
my $flag = $json->BoolAt($index);
Returns the boolean value of the member at zero-based position index.
JsonObject instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.Never dies: false is an answer, not a failure.
BoolOf
# $flag is true or false
my $flag = $json->BoolOf($jsonPath);
Returns the boolean value at jsonPath. The path is evaluated relative to this JsonObject, after applying PathPrefix if one is set.
Never dies: false is an answer, not a failure.
BytesOf
# $encoding is a string
# $bd is a Chilkat2::BinData
# $success is true or false
my $success = $json->BytesOf($jsonPath, $encoding, $bd);
Reads the string value at jsonPath, decodes it using encoding (for example, base64 or hex), and appends the resulting bytes to bd.
encoding argument tells Chilkat how that text represents the original bytes.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Clear
Removes all members from this JSON object, leaving an empty object equivalent to {}.
Returns the object, so calls can be chained.
topCopyRef
# $success is true or false
my $success = $json->CopyRef($jsonObj);
Updates jsonObj so that it references the same JSON object as the caller. No JSON data is copied.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
DateOf
# $dt is a Chilkat2::DateTime
# $success is true or false
my $success = $json->DateOf($jsonPath, $dt);
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.
CkDateTime.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Delete
# $success is true or false
my $success = $json->Delete($name);
Deletes the direct member named name from this JSON object.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
DeleteAt
# $success is true or false
my $success = $json->DeleteAt($index);
Deletes the member at zero-based position index. Members after the deleted position shift toward the beginning.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
DeleteRecords
# $relpath is a string
# $value is a string
# $caseSensitive is a boolean
# $n is an integer
my $n = $json->DeleteRecords($arrayPath, $relpath, $value, $caseSensitive);
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.
DtOf
# $bLocal is a boolean
# $dt is a Chilkat2::DtObj
# $success is true or false
my $success = $json->DtOf($jsonPath, $bLocal, $dt);
Parses the date/time value at jsonPath into dt. If bLocal is 1, 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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Emit
my $str = $json->Emit();
Serializes the JSON document rooted at this object and returns the JSON text. Formatting is controlled by EmitCompact and, for pretty output, EmitCrLf.
Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
EmitBd
Serializes this JSON and appends the resulting bytes to bd.
BinData is preserved.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
EmitSb
Serializes this JSON and appends the resulting text to sb. Formatting follows EmitCompact and EmitCrLf.
StringBuilder is preserved; the emitted JSON is added after it.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
EmitWithSubs
# $omitEmpty is a boolean
# $str is a string or undef
my $str = $json->EmitWithSubs($subs, $omitEmpty);
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 1, members whose substituted result is an empty string or empty array are omitted from the emitted JSON.
Predefine and LoadPredefined when the same JSON shape is emitted repeatedly with different values.Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
FindObjectWithMember
# $jsonObject is a Chilkat2::JsonObject or undef
my $jsonObject = $json->FindObjectWithMember($name);
Recursively searches this JSON subtree for the first JSON object containing a direct member named name. Returns that object, or undef if no matching object is found.
Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is. The returned object is new and independent of this one, and inherits its RaiseError.
FindObjectWithMember2
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->FindObjectWithMember2($name, $jsonObj);
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 1.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
FindRecord
# $relPath is a string
# $value is a string
# $caseSensitive is a boolean
# $jsonObject is a Chilkat2::JsonObject or undef
my $jsonObject = $json->FindRecord($arrayPath, $relPath, $value, $caseSensitive);
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.
* to match zero or more characters. relPath is evaluated relative to each record object in the array.Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is. The returned object is new and independent of this one, and inherits its RaiseError.
FindRecord2
# $relPath is a string
# $value is a string
# $caseSensitive is a boolean
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->FindRecord2($arrayPath, $relPath, $value, $caseSensitive, $jsonObj);
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 1.
jsonObj modify that record.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
FindRecordString
# $relPath is a string
# $value is a string
# $caseSensitive is a boolean
# $retRelPath is a string
# $str is a string or undef
my $str = $json->FindRecordString($arrayPath, $relPath, $value, $caseSensitive, $retRelPath);
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.
Name is Advertising and return its Id.” The * wildcard may be used in value.Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is.
FirebaseApplyEvent
# $data is a string
# $success is true or false
my $success = $json->FirebaseApplyEvent($name, $data);
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}}.
put replaces the value at a path, while patch updates individual child keys.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
FirebasePatch
# $jsonData is a string
# $success is true or false
my $success = $json->FirebasePatch($jsonPath, $jsonData);
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.
jsonPath is relative to this JsonObject.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
FirebasePut
# $value is a string
# $success is true or false
my $success = $json->FirebasePut($jsonPath, $value);
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.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
GetDocRoot
my $jsonObject = $json->GetDocRoot();
Returns a JsonObject reference to the root object of the JSON document containing this object. This can be called from any nested object reference.
JsonObject references share the same underlying JSON document. The document remains available while at least one such reference is retained by the application.Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way. The returned object is new and independent of this one, and inherits its RaiseError.
GetDocRoot2
# $success is true or false
my $success = $json->GetDocRoot2($docRoot);
Updates docRoot to reference the root object of the JSON document containing the caller and returns 1 on success.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
HasMember
# $flag is true or false
my $flag = $json->HasMember($jsonPath);
Returns 1 if a value exists at jsonPath; otherwise returns 0.
null still exists. Use IsNullOf to test specifically for JSON null.Never dies: false is an answer, not a failure.
topIndexOf
# $n is an integer
my $n = $json->IndexOf($name);
Returns the zero-based position of the direct member named name, or -1 if that member name is not found.
name is searched only among the direct members of this object.IntAt
# $n is an integer
my $n = $json->IntAt($index);
Returns the integer value of the member at zero-based position index.
JsonObject instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.IntOf
# $n is an integer
my $n = $json->IntOf($jsonPath);
Returns the integer value at jsonPath. The path is evaluated relative to this JsonObject, after applying PathPrefix if one is set.
StringOf or the exact numeric-text APIs when a JSON integer may exceed the range of the language binding's integer type.IsNullAt
# $flag is true or false
my $flag = $json->IsNullAt($index);
Returns 1 if the member at zero-based position index has the JSON value null; otherwise returns 0.
Never dies: false is an answer, not a failure.
IsNullOf
# $flag is true or false
my $flag = $json->IsNullOf($jsonPath);
Returns 1 if the value at jsonPath is the JSON literal null; otherwise returns 0.
null is different from a missing member and from an empty string. Use HasMember when existence must be tested separately.Never dies: false is an answer, not a failure.
JsonTypeOf
# $n is an integer
my $n = $json->JsonTypeOf($jsonPath);
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 |
Load
# $success is true or false
my $success = $json->Load($json);
Parses the JSON text in json and loads the parsed data into this object for DOM-style access and modification.
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
LoadBd
Parses JSON from the bytes contained in bd and loads it into this object.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
LoadFile
# $success is true or false
my $success = $json->LoadFile($path);
Reads JSON text from the file at path, parses it, and loads the result into this object.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
LoadPredefined
# $success is true or false
my $success = $json->LoadPredefined($name);
Loads this object from the predefined JSON document identified by name. Predefined documents are created with Predefine.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
LoadSb
Parses JSON from the current contents of sb and loads it into this object.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
MakeCopy
# $success is true or false
my $success = $json->MakeCopy($json);
Copies this JSON object into json. The destination receives an independent JSON copy rather than another reference to the same underlying object.
CopyRef when two JsonObject instances should refer to the same JSON object instead of duplicating its data.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
MoveMember
# $toIndex is an integer
# $success is true or false
my $success = $json->MoveMember($fromIndex, $toIndex);
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
NameAt
# $str is a string or undef
my $str = $json->NameAt($index);
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 undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
NewArrayOf
# $jArr is a string
# $success is true or false
my $success = $json->NewArrayOf($path, $jArr);
Creates a JSON array at path and loads that array from the JSON text in jArr. The supplied text should represent a JSON array.
UpdateNewArray creates an empty array. NewArrayOf creates the array and immediately populates it from JSON text.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
NewObjectOf
# $jObj is a string
# $success is true or false
my $success = $json->NewObjectOf($path, $jObj);
Creates a JSON object at path and loads that object from the JSON text in jObj. The supplied text should represent a JSON object.
UpdateNewObject creates an empty object. NewObjectOf creates the object and immediately populates it from JSON text.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ObjectAt
# $jsonObject is a Chilkat2::JsonObject or undef
my $jsonObject = $json->ObjectAt($index);
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.
index must be a JSON object. Use TypeAt when the type is not already known.Returns undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way. The returned object is new and independent of this one, and inherits its RaiseError.
ObjectAt2
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->ObjectAt2($index, $jsonObj);
Updates jsonObj to reference the JSON object stored at zero-based member position index and returns 1 on success.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
ObjectOf
# $jsonObject is a Chilkat2::JsonObject or undef
my $jsonObject = $json->ObjectOf($jsonPath);
Returns the JSON object at jsonPath. The returned object is a live reference into the same JSON document, not a copy.
GetDocRoot when access must start from the document root.Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is. The returned object is new and independent of this one, and inherits its RaiseError.
ObjectOf2
# $jsonObj is a Chilkat2::JsonObject
# $success is true or false
my $success = $json->ObjectOf2($jsonPath, $jsonObj);
Updates jsonObj to reference the JSON object at jsonPath and returns 1 on success.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Predefine
# $success is true or false
my $success = $json->Predefine($name);
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.
JsonObject can load it by name with LoadPredefined.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Rename
# $newName is a string
# $success is true or false
my $success = $json->Rename($oldName, $newName);
Renames the direct member oldName to newName. The member value and its position are otherwise unchanged.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
RenameAt
# $name is a string
# $success is true or false
my $success = $json->RenameAt($index, $name);
Renames the member at zero-based position index to name. The member value is not changed.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetBoolAt
# $value is a boolean
# $success is true or false
my $success = $json->SetBoolAt($index, $value);
Sets the member at zero-based position index to a JSON boolean value.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetBoolOf
# $value is a boolean
# $success is true or false
my $success = $json->SetBoolOf($jsonPath, $value);
Sets the value at jsonPath to a JSON boolean value.
UpdateBool when missing objects or array positions along the path should be created automatically.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetIntAt
# $value is an integer
# $success is true or false
my $success = $json->SetIntAt($index, $value);
Sets the member at zero-based position index to a JSON number value. The integer is emitted as a JSON number.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetIntOf
# $value is an integer
# $success is true or false
my $success = $json->SetIntOf($jsonPath, $value);
Sets the value at jsonPath to an integer JSON number.
UpdateInt when missing objects or array positions along the path should be created automatically.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetNullAt
# $success is true or false
my $success = $json->SetNullAt($index);
Sets the member at zero-based position index to a JSON null value.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetNullOf
# $success is true or false
my $success = $json->SetNullOf($jsonPath);
Sets the value at jsonPath to a JSON null value.
UpdateNull when missing objects or array positions along the path should be created automatically.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetNumberAt
# $value is a string
# $success is true or false
my $success = $json->SetNumberAt($index, $value);
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.
NaN, and infinity are not valid JSON numbers.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetNumberOf
# $value is a string
# $success is true or false
my $success = $json->SetNumberOf($jsonPath, $value);
Sets the value at jsonPath to a JSON number value. The value argument supplies the exact textual form of the JSON number.
UpdateNumber when missing objects or array positions along the path should be created automatically.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetStringAt
# $value is a string
# $success is true or false
my $success = $json->SetStringAt($index, $value);
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 on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SetStringOf
# $value is a string
# $success is true or false
my $success = $json->SetStringOf($jsonPath, $value);
Sets the value at jsonPath to a JSON string value. The string is escaped as required when JSON is emitted.
UpdateString when missing objects or array positions along the path should be created automatically.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
SizeOfArray
# $n is an integer
my $n = $json->SizeOfArray($jsonPath);
Returns the number of elements in the JSON array at jsonPath. Returns -1 if the path does not resolve to an existing JSON array.
Sort
# $caseSensitive is a boolean
$json->Sort($ascending, $caseSensitive);
Sorts this object's direct members by member name. ascending selects ascending or descending order, and caseSensitive controls how names are compared.
Returns the object, so calls can be chained.
StringAt
# $str is a string or undef
my $str = $json->StringAt($index);
Returns the string value of the member at zero-based position index.
JsonObject instance. JSON objects are semantically unordered, so application protocols should normally identify values by member name rather than by position.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 undef on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
StringOf
# $str is a string or undef
my $str = $json->StringOf($jsonPath);
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.
JsonTypeOf, IntOf, BoolOf, or IsNullOf when the distinction between JSON types is important.Returns undef if not found: this is not an error, and it never dies, whatever RaiseError is.
StringOfEquals
# $value is a string
# $caseSensitive is a boolean
# $flag is true or false
my $flag = $json->StringOfEquals($jsonPath, $value, $caseSensitive);
Returns 1 if the textual value at jsonPath equals value according to the caseSensitive setting; otherwise returns 0.
Never dies: false is an answer, not a failure.
topStringOfSb
# $sb is a Chilkat2::StringBuilder
# $success is true or false
my $success = $json->StringOfSb($jsonPath, $sb);
Retrieves the value at jsonPath as text and appends it to sb.
StringBuilder are preserved.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
Swap
# $index2 is an integer
# $success is true or false
my $success = $json->Swap($index1, $index2);
Swaps the positions of the direct members at zero-based indexes index1 and index2. Member names and values are unchanged.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
TypeAt
# $n is an integer
my $n = $json->TypeAt($index);
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 |
UIntOf
# $n is an integer
my $n = $json->UIntOf($jsonPath);
Returns the unsigned integer value at jsonPath.
UpdateBd
# $encoding is a string
# $bd is a Chilkat2::BinData
# $success is true or false
my $success = $json->UpdateBd($jsonPath, $encoding, $bd);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateBool
# $value is a boolean
# $success is true or false
my $success = $json->UpdateBool($jsonPath, $value);
Updates the value at jsonPath to a JSON boolean value, or creates the member and any missing path components as needed.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateInt
# $value is an integer
# $success is true or false
my $success = $json->UpdateInt($jsonPath, $value);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateNewArray
# $success is true or false
my $success = $json->UpdateNewArray($jsonPath);
Creates or replaces the value at jsonPath with a new empty JSON array. Missing path components are created automatically as needed.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateNewObject
# $success is true or false
my $success = $json->UpdateNewObject($jsonPath);
Creates or replaces the value at jsonPath with a new empty JSON object. Missing path components are created automatically as needed.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateNull
# $success is true or false
my $success = $json->UpdateNull($jsonPath);
Updates the value at jsonPath to a JSON null value, or creates the member and any missing path components as needed.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateNumber
# $numericStr is a string
# $success is true or false
my $success = $json->UpdateNumber($jsonPath, $numericStr);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.UpdateNumber instead of UpdateInt for decimal/exponent forms, very large integers, or when preserving exact numeric text is important.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateSb
# $sb is a Chilkat2::StringBuilder
# $success is true or false
my $success = $json->UpdateSb($jsonPath, $sb);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateString
# $value is a string
# $success is true or false
my $success = $json->UpdateString($jsonPath, $value);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
UpdateUInt
# $value is an integer
# $success is true or false
my $success = $json->UpdateUInt($jsonPath, $value);
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.
jsonPath is interpreted using DelimiterChar, PathPrefix, and the I/J/K index substitutions.Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.
WriteFile
# $success is true or false
my $success = $json->WriteFile($path);
Serializes this JSON and writes it to the file at path. Output formatting follows EmitCompact and EmitCrLf.
Returns true on success, false on failure; LastErrorText says why. With RaiseError on, a failure dies with a Chilkat2::Error instead (it stringifies to the LastErrorText); the object remains usable either way.