Skip to content

stevenwhitespacesystems/fm-xml2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation


Logo

fm-xml2json

An XML Parser that converts XML into JSON on the FileMaker Pro Platform.
Explore the docs »

View Demo · Report Bug · Request Feature

FileMaker Version FileMaker Platform Commit Shield Contributors MIT License LinkedId

Table of Contents

About The Project

Product Name Screen Shot

As we delved into the world of REST APIs using FileMaker, we stumbled across an issue.

How do we handle XML responses?

When the REST response is a JSON object, we don't have any issue and can make use of the JSON functions introduced in FileMaker 16 to manipulate that response as we need.

However, we found out during our development of fmapi-aws-s3 that REST APIs can respond in XML.

This was an issue and with any issue, solutions are born.

We present fmapi-fm-xml2json.

A FileMaker script which when passed a valid XML string, will covert this string into a JSON object.

Built With

Getting Started

Prerequisites

Version

The FileMaker script makes use of the JSON Functions introduced in FileMaker 16.

This means that this script will only work with FileMaker 16+ products.

Using the script with anything less than 16 will have unexpected behaviour.

Custom Functions

We make use of the #Name-Value custom function provided by filemakerstandards.

Please copy the following Custom Functions to your solution before copying the script:

Limitations

Large XML Data

FileMaker Pro is not the most efficient tool for text parsing. This script was designed primarily for small XML packets sent back from APIs. It wasn't designed, in mind, to convert large XML files into JSON.

However, if given enough time, this script will convert large XML files into JSON and has been optimised to the best of our ability.

Unfortunately, FileMaker can only go so far before it starts to fall over.

We've performed some benchmark tests to give you an idea of how long it takes the script to execute.

XML Size (KB) Execution Time (ms) Readable Time
4 958 0.9s
8 1644 1.6s
17 3430 3.4s
35 8767 8.7s
71 26435 26.4s
142 87973 1min 27.9s

KB was determined using FileMaker's Length ( field ) function.

As stated above this script wasn't developed with the purpose of taking large XML data and converting it to JSON.

If you do have this need, we strongly suggest using a plugin or performing the conversion outside of FileMaker and then importing the result back into FileMaker.

FileMaker Text Parsing Functions

We have built the rules for identifying XML nodes in FileMaker using all the Text Functions available to us and from our testing it has handled all the testing XML data thrown at it.

However, there may be some fringe cases where this breaks down. If you discover such a case, please create a Bug Report and we'll see if we can correct it. Unfortunately, there may be cases that can't be solved.

Installation

  1. Make sure that the Custom Functions have been added to your solution.
  2. Copy the fm-xml2json script to your solution.

Usage

TODO

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature)
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Steven McGill - WhiteSpace Systems Ltd - steven@whitespacesystems.co.uk

Project Link: fm-xml2json

Acknowledgements

About

An XML Parser that converts XML into JSON on the FileMaker Pro Platform.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published