Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
This is not just any blog…this is an affiliate feature blog from the Scarpetta Group! Have you ever been given a huge block of nested JSON, or you are playing around with an API and you would like to see the keys for what is being returned?
With the introduction of FileMaker 16’s JSON functions and a single script you can get a list of all the unique paths down to each key value pair. This is a recursive script that drills down and generates a list of unique keys based on the JSON it is evaluating.
The example above is a snippet of the path list that was returned from the script. As we can see above each value is unique. Taxable is found in the first array of customers ( index 0 ). Looking at the list it jumps from Customer index 0 ( QueryResponse.Customer. ) to Customer index 6 (QueryResponse.Customer.). The script did not skip the arrays in-between but instead found no unique values that were not already reported in the list above.
The two major ways I feel this tool can be handy are:
- Quickly running through a block of JSON and identifying all the unique elements that it contains so you can determine which values you want to extract from the JSON.
- Once the full list is generated, it is stored in a global variable and in a field as well. You can go back to this list and copy and paste the path into a JSONGetElement and it will return the result. In the demo file once you paste and parse the JSON there is a button that will open a card window and grab a random value from the generated list of keys and provide the value associated with that key.
I hope this helps simplify some of the JSON and API work people are doing. Feel free to ask any questions or provide feedback.
If you are looking to add JSON to any of your FileMaker Apps or Solutions contact the Scarpetta Group.
I hope this helps simplify some of the JSON and API work people are doing. Feel free to ask any questions or provide feedback. You can also contact me for a FREE demo file.