Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
JSON.AddStringToObject
Adds a new entry to the object with the given name and value.
| Component | Version | macOS | Windows | Linux | Server | FileMaker 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.
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.AddNumberToObject
- JSON.AddTrueToObject
- JSON.CreateArrayRef
- JSON.CreateObject
- JSON.CreateObjectRef
- JSON.GetObjectItem
- MapView.AddPoint
- MapView.Snapshot
- SQL.SetParamsWithJSON
Example Databases
- CURL/WebServices/CURL FMS Admin API v17
- CURL/WebServices/CURL FMS Admin API v18
- Mac and iOS/MapKit/MapKit Snapshots
- Mac and iOS/MapKit/MapView BeeExample
- SQL to other databases/SQLite fun
Blog Entries
FileMaker Magazin
Created 18th August 2014, last changed 11st December 2016
JSON.AddStringToArray - JSON.AddTrueToObject
Feedback: Report problem or ask question.
Links
MBS FileMaker blog