Brian Dunning's FileMaker Custom Functions

ExtractAllTextValuesForKey ( json ; key )

Extracts JSONString values from JSON at whatever depth

  Be the first to rate this function Log in to vote

Richard Dyce   Richard Dyce - Show more from this author
Dyce & Sons Ltd.
http://dyce.com

Share on Facebook Share on Twitter

  Sample input:
ExtractAllTextValuesForKey ( "[ { \"content\": [ { \"text\": \"Main title\", \"type\": \"text\" } ], \"type\": \"paragraph\" }, { \"content\": [ { \"content\": [ { \"content\": [ { \"text\": \"Abcde\", \"type\": \"text\" }, { \"type\": \"hardBreak\" }, { \"text\": \"This is a sentence.\", \"type\": \"text\" } ], \"type\": \"paragraph\" } ], \"type\": \"listItem\" } ] } ]" ; "text" )
  Sample output:
"Main title¶Abcde¶This is a sentence."

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

This function uses a while to pullout the text values for a give key, at whatever level the key appears.

 

Comments

Kyle Williams   Kyle Williams, Augusto Digital
Jan 13, 2021
Your sample input shows you are using this function "ExtractAllAtomicValuesForKey".. but your function's name is "ExtractAllTextValuesForKey". Not sure where "AtomicValues" comes in?

This sounds like an interesting function, thanks for sharing.
 
Richard Dyce   Richard Dyce, Dyce & Sons Ltd.
Jan 14, 2021
Fixed :-)
 

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: