Brian Dunning's FileMaker Custom Functions

Json2Vars ( json )

Create local variables for all keys belongs to the JSON document's root node.

  Be the first to rate this function Log in to vote

Pascal Surget   Pascal Surget - Show more from this author
Creaxion solutions

Share on Facebook Share on Twitter

  Sample input:
{ "id":123, "color":"blue" }
  Sample output:
$id (123), $color ("blue")

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

* Json2Var ( json )
* Based on the custom function of Fabrice Nordmann xml2var.
* Thanks Fabrice, I used your custom function for so many years.
* json - JSON data
* CREATED on 2021-05-20 by Pascal Surget
* Create local variables for all keys belongs to the JSON document's root node.
* For example, given the following JSON, this custom function will create $id and $color variables: { "id" : "123", "color" : "blue" }
* This custom function will return an error code as a result.
* 0 means success or empty JSON.
* 5 means invalid JSON.
* 1204 means one of the JSON root keys did not conform to the FileMaker naming restrictions for variable and fields.
* Pre-19 clients will return "?".
* Errors will be indicated in the custom function result using standard FileMaker error codes:
* Keys must be named following the same naming restrictions as FileMaker variables and fields:
* Does not require any other custom functions. Requires v19 or later client. Pre-19 clients will return "?".



Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 18 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: