Brian Dunning's FileMaker Custom Functions

JSON.AssignVariables ( json )

Assign key/value pairs of a JSON object to become variables and values.

  Average rating: 5.0 (1 vote) Log in to vote

Michael Wallace   Michael Wallace - Show more from this author
Empowered Data Solutions
http://empowereddatasolutions.com

Share on Facebook Share on Twitter

  Sample input:
JSON.AssignVariables("{\"test\":1,\"hello\":\"world\"}")
  Sample output:
Variables set: $test=1 and $hello="world"

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

* =====================================
* JSON.AssignVariables
*
* Modified from #AssignScriptParameters
*
* PURPOSE:
* JSON.AssignScriptResults uses the current script result assuming
* JSON format to declare and populate a series of locally-scoped script variables.
*
* RETURNS:
* True (Nonzero) when the script parameter is a valid set of name-value pairs (which
* includes the empty string) and all parameters defined as required according to
* the script name are non-null; False (0) otherwise.
*
* PARAMETERS: json
*
* DEPENDENCIES: none
*
*
* HISTORY:
* MODIFIED on 2020-05-02 by Michael Wallace of Empowered Data Solutions to handle
* values that start and end with {} or [] but are not JSON elements or arrays
* PORTED on 2019-03-28 by michael.wallace@empoweredds.com to use JSON parameters
* MODIFIED on 2010-10-04 by jeremy@kyologic.com to return explicit True or
* False values indicating successful evaluation of the script parameter, and to
* fit syntax inspired by a comment on standards.filemakermagazine.com by
* Richard Dyce.
* CREATED on 2010-03-13 by Jeremy Bante of Kyo Logic (jeremy@kyologic.com).
* INSPIRED by an example in the FileMaker help documentation.
*
* =====================================

 

Comments

Mark D Kerr   Mark D Kerr, Discovery Reef Design & Consulting
Jun 28, 2021
Sending a medium size (1550k) base 64 encoded image as a paramater crashes the function. Same thing happens for 2 others similar ones I've tried. Just a constructive FYI.
 
Michael Wallace   Michael Wallace, Empowered Data Solutions
Jun 29, 2021
I would recommend passing the info to the script that is needed to retrieve that image rather than trying to pass the whole image as a script parameter.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. 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 20 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: