Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.AddStringToObject
Adds a new entry to the object with the given name and value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 2.7 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | {"key": "value"} |
Name... | The name of the Object property. | "length" |
Value... | The text value to add. | "Hello |
Result
Returns JSON code.
Description
Adds a new entry to the object with the given name and value.With version 6, you can pass several parameters to add several entries to the object.
When adding to a JSON reference, the function returns that reference number.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat Name and Value parameters as often as you need.
Examples
Create object, add content and pick value:
Let(
[
j = MBS( "JSON.CreateObject");
j = MBS( "JSON.AddStringToObject"; j; "hello"; "world" );
r = MBS( "JSON.GetObjectItem"; j; "hello" )
];
r)
Example result: "world"
Build nested objects:
Set Variable [$j1; MBS( "JSON.CreateObject") ]
Set Variable [$j2; MBS( "JSON.AddStringToObject"; $j1; "name"; "" ) ]
Set Variable [$j3; MBS( "JSON.AddStringToObject"; $j2; "record_type"; "MX" ) ]
Display Dialog ["JSON"; $j3]
Set Variable [$j4; MBS( "JSON.CreateObject") ]
Set Variable [$j5; MBS( "JSON.AddItemToObject"; $j4; "record"; $j3 ) ]
Display Dialog ["JSON"; $j4]
Add two entries in one call:
MBS( "JSON.AddStringToObject"; "{}"; "hello"; "world"; "test"; "entry")
Example result:
{
"hello": "world",
"test": "entry"
}
Adds string to object:
MBS( "JSON.AddStringToObject"; "{}"; "test"; "Hello World" )
Example result:
{
"test": "Hello World"
}
See also
- JSON.AddFalseToObject
- JSON.AddItemToArray
- JSON.AddItemToObject
- JSON.AddNumberToObject
- JSON.AddStringToArray
- JSON.CreateArrayRef
- JSON.CreateObject
- JSON.CreateObjectRef
- JSON.GetObjectItem
- MapView.Snapshot
Example Databases
- CURL/WebServices/CURL FMS Admin API v17
- CURL/WebServices/CURL FMS Admin API v18
- Files/FileOperation
- Mac and iOS/MapKit/MapKit Snapshots
- Mac and iOS/MapKit/MapView BeeExample
- SQL to other databases/SQLite fun
Blog Entries
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 5th June 2021