Brian Dunning's FileMaker Custom Functions

FMListToJSONArray ( key ; fmList )

Translate a FileMaker list into a proper JSON Array without recursion.

  Average rating: 4.4 (5 votes) Log in to vote

Michael Twisdale   Michael Twisdale - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
FMListToJSONArray ( "car" ; "" )
FMListToJSONArray ( "" ; "" )
FMListToJSONArray ( "car" ; "¶Ford¶¶BMW¶" )
  Sample output:
{"car":[""]}
[""]
{"car":["","Ford","","BMW",""]}

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

For more see GitHub - twisdale/FMListToJSONArray: Translate a FileMaker list into a proper JSON Array .

Look at the Readme file.

 

Comments

Lewis Lorenz   Lewis Lorenz, Lorenz Companies
Jul 21, 2021
This is a great function. I ran into an issue where it does not produce valid JSON if a quotation mark (") is in a FM valuelist element. I tried using Quote on the valuelist and escaping the quote without success. Can you help with a solution?
Thank you.
 
Jason Lecureux   Jason Lecureux
Aug 27, 2024
Forgive my ignorance but what use cases does this cover as opposed to something simpler like:
Let ( [
fmList = "[\"" & Substitute ( fmList; ¶ ; "\",\"" ) & "\"]"
;obj = JSONSetElement ( ""; "key"; fmList; "" )
];
obj
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: