Menno

Evaluate JSON path with CF's

Discussion created by Menno on Sep 26, 2016
Latest reply on Sep 30, 2016 by Menno

I was looking for a way to read data from a JSON and found myself struggling with plug-ins that don't work on iOS and the very nice example from modularfilemaker.org. The example from MFM did not work for me because it can interfere with my own (script-) variables and since it relies on scripts it also a bit difficult to implement without errors.

 

So I created a set of custom-functions that seem to work in most cases. you can download my examples from: http://www.filemakertips.nl/?ddownload=692 There is a "?"button where you can see the shortest explanation on how to implement the custom-functions.

 

A few remarks here:

  1. Make sure that the JSON you evaluate is cleansed from hidden whitespaces like Char(160)
  2. Paths are written like /element[i]/element[j] etc. instead of $.element.element etc that is simply my preference
  3. This uses a few recursive functions, where the maximum number of iterations is limited, so there is a limit to the size of JSON that can be evaluated
  4. This all works on iOS too

 

Feel free to leave any comments and questions or found issues here in this topic

 

kind regards, Menno

Outcomes