Platforms to show: All Mac Windows Linux Cross-Platform
Back to JSONMBS class.
JSONMBS.ApplyMergePatch(target as JSONMBS, patch as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The mergepatch function implement the IETF standard JSON Merge Patch
JSONMBS.ApplyPatch(target as JSONMBS, patch as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The jsonpatch functions implement the IETF standard JavaScript Object Notation (JSON) Patch.
The JSON Patch IETF standard requires that the JSON Patch method is atomic, so that if any JSON Patch operation results in an error, the target document is unchanged. The patch function implements this requirement by generating the inverse commands and building an undo stack, which is executed if any part of the patch fails.
JSONMBS.Convert(value as variant) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 19.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Converts values in variant to matching JSON structures.
Currency is converted to double. Color is converted to integer. Dates are converted to string.
We detect arrays of String, Object, Variant, Single, Double, Int32, Int64, Boolean and Currency and convert them to JSON arrays. Dictionaries are converted to JSON objects with texts for keys.
Anything else can raise an exception about an unsupported type.
Please note that Xojo variants don't make a difference between signed and unsigned integers, so we always convert using signed integers.
With version v19.3, the array/dictionary can also contain JSONMBS objects.
With version v24.3 we also convert JSONItem and convert folderitem, date or DateTime objects to strings.
See also:
JSONMBS.Flatten(value as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 23.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The keys in the flattened object are normalized json paths. The values are primitive (string, number, boolean, or null), empty object ({}) or empty array ([]).
JSONMBS.isValidJSON(JSON as string) as Boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This parses the JSON text and returns true on success or false on failure.
This checks if the given text is a valid JSON fragment and can be e.g. added as value to a JSON object or array. So this returns true for proper formatted boolean, number and text pieces, too.
JSONMBS.JSONObjectCount as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 15.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
JSONMBS.MergePatchFromDiff(source as JSONMBS, target as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The mergepatch function implement the IETF standard JSON Merge Patch
Returns a JSON Merge Patch.
JSONMBS.PatchFromDiff(source as JSONMBS, target as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Returns a JSON Patch.
The jsonpatch functions implement the IETF standard JavaScript Object Notation (JSON) Patch.
The JSON Patch IETF standard requires that the JSON Patch method is atomic, so that if any JSON Patch operation results in an error, the target document is unchanged. The patch function implements this requirement by generating the inverse commands and building an undo stack, which is executed if any part of the patch fails.
See also:
JSONMBS.PatchFromDiff(source as JSONMBS, target as JSONMBS, KeyToCopy as String) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 24.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Same as normal PatchFromDiff, but copies the given primary key field from JSON entries to the diff.
See also:
JSONMBS.Unflatten(value as JSONMBS) as JSONMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| shared method | JavaScript Object Notation | MBS Util Plugin | 23.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The keys in the flattened object are normalized json paths. The values are primitive (string, number, boolean, or null), empty object ({}) or empty array ([]).
The items on this page are in the following plugins: MBS Util Plugin.