MBS JSON Functions

How do the MBS JSON functions perform in comparison to the build-in native FileMaker Pro JSON functions which I perceive as less performant?

2 Likes

Real good. I haven't done benchmarks but they are fundamentally different than the built-in FM JSON functions.

The MBS JSON functions parse the json and return a handle (a number). You then pass that handle around to identify which JSON is being read/modified at any time. This is much more efficient than FM's functions which pass the whole JSON string around to identify it.

Also, I believe the MBS functions can parse multiple objects at once, whereas if you jump back and forth between different JSON objects in the native functions, it has to re-parse the JSON each time!

So, if you're doing heavy JSON processing, then the MBS functions can be a huge performance win. But I'd personally avoid using them in cases where the native ones perform sufficiently well--there's no need to optimize the speed of parsing a small, say, json script parameter with a couple properties.

3 Likes

I am not surprised to see that the plugin is more advanced then native FMP but disappointed frankly!

Thank you for your expertise @jwilling !

Why disappointed?

You may enjoy some special functionality. Maybe just enjoy JSON.Colorize to get a bit color.

Or you try our more advanced functions like the new JSON.Query function and process bigger JSON data blocks into smaller items.

1 Like

I am very impressed by the MBS plugin. What I meant by "disappointing" is that FM or Claris is so easily outperformed by the plugin. That native FM funcitons are significantly slower (as I understood) then the plugins functions is IMHO disappointing or is it?

2 Likes

@barefoot of course we'd all LOVE better performance from the native functions, but I can see why Claris implemented them as they did.

For non-programmers, the idea of returning a handle like "7" from a function like JSONSetElement might be intimidating, and Claris aims to be friendly for low-coders and citizen developers.

By having the function accept the whole json string as the first parameter, and return the whole json string back, it makes it a little easier to eyeball what's happening, instead of having to conceptualize what's gong on "behind the scenes".

That said, I've long thought FileMaker should give us some native Object() and Array() functions that behave like MBS plugin--and which store native FM data types like Text/Timestamp/Time etc.... These would return an object/array id (similar to MBS). Then when you want to serialize the output, they could provide us all sorts of cool serializers for different formats: ObjectToJSON(objId), ObjectToXML(objId), ObjectToYAML(objId) etc... But that's just wishful thinking, and we have MBS after all.

3 Likes