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: 10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4   11.5   11.6    Statistic    FMM    Blog  


Sets a value in a JSON hierarchy.

Component Version macOS Windows Linux Server iOS SDK
JSON 6.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "JSON.SetPathItem"; json; Path; Value )   More


Parameter Description Example
json A JSON text or reference. "[1,2,3]"
Path The path through the json hierarchy as list.
For object, pass name of item to choose. For array pass index.
For last array you can use special value "append" to add an entry.
Value The new value as JSON. "\"Hello\""


Returns JSON or error.


Sets a value in a JSON hierarchy.
The path describes the way through the hierarchy to find the JSON node to return.
Please pass in new value as JSON.

Version 9.2 automatically creates missing object/array entries. The value parameter will be treated as text if it is not a valid JSON instead of reporting an error.


Adds an entry with country:

MBS( "JSON.SetPathItem"; "{\"people\":[{\"first\":\"Christian\",\"last\":\"Schmitz\",\"city\":\"Nickenich\"}]}"; "people¶0¶country"; "\"Germany\"")

Example result:
  "people":   [{
      "first":   "Christian",
      "last":   "Schmitz",
      "city":   "Nickenich",
      "country":   "Germany"

Sets an entry in an array:

MBS( "JSON.SetPathItem"; "[1,2,3]"; "1"; 5)

Example result: [1, 5, 3]

Adds an entry to array in object:

MBS( "JSON.SetPathItem"; "{\"test\":[1,2,3]}"; "test¶append"; 5)

Example result:
  "test":   [1, 2, 3, 5]

Sets hierarchical item:

MBS( "JSON.SetPathItem"; "{}"; "Hello¶World¶Test"; "Hello" )

Example result:
  "Hello":   {
    "World":   {
      "Test":   "Hello"

Create missing array entries and add our new one:

MBS( "JSON.SetPathItem"; "[]"; "5"; "6th item" )

Example result: [null, null, null, null, null, 6]

See also

Release notes

Example Databases

Blog Entries

FileMaker Magazin

Created 3th February 2016, last changed 3th April 2019

JSON.ReplaceItemInObject - JSON.Sort

Feedback: Report problem or ask question.

MBS Xojo Plugins

Start Chat