encodeFM v1.0.1

Published by Soliant Consulting on March 10, 2021
Updated on July 5, 2021
Tags: Development
Download Send To Carafe
Download Send To Carafe
Created By: ryng64
Version: 1.0.1

Windows Tested: Yes
Offline Compatible: Yes

Description:

Usage


Paste in a any valid JSON and click Translate or Translate 💥 (exploded)


Translate buttons convert JSON to a FileMaker expression in all versions of FM that support a webviewer.



Example Data


FileMaker dapi request


{
"layouts":"Projects",
"limit":25,
"offset":5,
"query":[
{
"Status":"Active",
"AssignedTo":"Ricky"
}
],
"sort":[
{
"fieldName":"Priority",
"sortOrder":"ascend"
}
]
}

JSON Types


{
"Null": null,
"True": true,
"False": false,
"Empty": "",
"Text": "Test Text",
"Number": 420,
"ObjectEmpty": {},
"Object": {"A":1, "b":"two"},
"ArrayNested": [1,"two",{"A":1, "b":"two"},[1,2,"three"]],
"ArrayStrings": ["one","two","three"],
"ArrayNumber": [1,2,3],
"ArrayEmpty": []
}
A FileMaker tool to convert JSON syntax into the FileMaker JSONSetElement syntax

Configuration

Name Description Type
References:

6 Comments

ryng64 · July 2, 2021 at 7:49 pm

Hi there! Thanks for adding this project to the bundles here! I have made an update today to take care of Objects with keys that contain “.” in them. While JSON allows for this, JSONSetElement(“{}” ; “dot.notation”; 123 ; JSONNumber ) for example would create a json object like {“dot”:{“notation”: 123 } } instead of {“dot.notation” :123 }.

the update solves this by generating any dot notation keys as “.[‘dot.notation’]” to enable the above to work.

    Jeremiah Small · July 3, 2021 at 11:27 am

    That sounds like a great update. I’ll get the bundle updated with that asap. I’d been thinking of putting in a PR suggestion to format your line breaks slightly differently for the FileMaker expressions. We’ve become big fans of doing this

    JSONSetElement( "{}"
    ; ["foo"; "bar"; JSONString]
    ; ["baz"; "bat"; JSONString]
    )

    instead of this

    JSONSetElement( "{}";
    ["foo"; "bar"; JSONString];
    ["baz"; "bat"; JSONString]
    )

    It makes it much easier to shift things up and down if you need to, and it’s somewhat easier to read. What do you think?

      ryng64 · July 4, 2021 at 1:24 pm

      Thanks for the tip! I see what you mean about moving things around or adding another key for example. This is much easier to work with.

      I’ve updated the repo once more to accommodate this

Jeremiah Small · July 3, 2021 at 11:32 am

Do you want to update the package version before I re-bundle it for Carafe? https://github.com/ryng64/encodeFM/blob/331b2756d88aff6b254cf7983c7288e0cd998e95/package.json#L3

Also, is the canonical version meant to be the public Github repo? I see you have what looks like a private Gitlab repo in the package.json

    ryng64 · July 4, 2021 at 1:26 pm

    Good catch! I didn’t notice since I moved this repo out from gitlab to github. But this should be updated now as well!

      Jeremiah Small · July 5, 2021 at 1:23 am

      Looks good. I’ve updated the bundle to your 1.0.1 release.

Leave a Comment