Hierarchical JSON Viewer / Editor

By Andy Persons & Doug West

One of the standout new features of FileMaker Pro 16 is native support for the JSON data-interchange format. In addition to providing easy integration with a host of online services, it also provides developers with the tools to create robust hierarchical structures for use entirely within FileMaker. This hierarchical JSON viewer / editor file provides some tools for visualizing, manipulating, and leveraging JSON text.

Features

  • Automatically creates a representation of any JSON text as a hierarchical portal of records, where individual elements can be expanded and collapsed
  • Dynamically replicates changes to the hierarchical records in the JSON text, including add, edit, and delete actions
  • Highlights the corresponding JSON element when a record is selected

Applications

  • Easily visualize large JSON text, collapsing nodes to focus on just the relevant sections.
  • Manipulate JSON without needing to worry about the correct syntax
  • Convert JSON returned from a web service directly into usable Filemaker records, customizing it to your needs
  • Create and store hierarchical structures entirely in text (such as global variables), and display it as hierarchical records on the fly

How it Works

  • When JSON text is initially entered, the “JSON – Create Children” script retrieves the root keys using  JSONListKeys(), loops through the result, and creates the root records.
  • When an element is eXpanded, the same script creates its child records if they don’t eXist and eXpands the hierarchy.
  • When eXpand All is clicked, a similar script “JSON – Create All Descendants” loops through every element recursively and creates all descendants.
  • Values for each record are retrieved and set using JSONGetElement().
  • To keep things streamlined, JSON key paths are used for the parent-child keys.
  • Records are marked as arrays based on the presence of a left bracket (“[“) and formatted accordingly.
  • Since JSONFormatElements() imposes a standard format, elements have a predictable number of leading and trailing lines. These are recorded in lines_leading and lines_trailing, respectively. They are then used in the Highlight Element script to calculate which part of the JSON text should be highlighted when an element record is clicked.

Enjoy our JSON data viewer file!

•• Download JSONViewer.fmp12 ••

Hierarchical JSON Viewer / Editor


**This article is provided for free and as-is, use, enjoy, learn, and experiment at your own risk – but have fun! eXcelisys does not offer any free support or free assistance with any of the contents of this blog post. If you would like help or assistance, please consider retaining eXcelisys’ FileMaker Pro consulting & development services.

About eXcelisys, Inc.: Founded in 2001, eXcelisys (www.excelisys.com)is an FBA Platinum Partner and FileMaker Certified developer organization. eXcelisys specializes in designing, developing, customizing, supporting, consulting, migrating, upgrading, fixing, and integrating of database solutions for Desktop, Mobile, and Web applications. Our core technology competencies are FileMaker Pro, FileMaker Go, and MySQL for database frameworks, along with FileMaker WebDirect, WordPress, MySQL, PHP, CodeIgniter, PostgreSQL, Joomla, Drupal, Magento, CSS, HTML5, and Javascript for web sites and web applications. Aside from providing eXcellent customer service, our goals are to use these technologies to intuitively automate your organization’s data solution needs seamlessly and flawlessly across the web, mobile, and desktop platforms. Contact eXcelisys today for a free estimate and consultation about making your business more efficient through intuitive and effective software automation. 866-592-9235.

eXcelisys, Inc. is an independent entity and this web site/information/blog post has not been authorized, sponsored, or otherwise affiliated with FileMaker, Inc. FileMaker is a trademark of FileMaker, Inc., registered in the U.S. and other countries.