ACF Library

JsonEvaluate

Back to List

Description: Returns the decoded value of a quoted JSON string

FileMaker Prototype:

Set Variable [$res; ACF_Run("JsonEvaluate"; string_quotedJSONString)]

Category: UTILITY

Function source:

function JsonEvaluate( string quotedJSONString )
   JSON t = '{"t":"'+quotedJSONString+'"}';
   string s =  t["t"];
   if ( left (s, 1) == '"') then
      s = substring ( s, 1); 
   end if
   if ( right (s,1) == '"') then
      s = substring ( s, 0, length(s)-1); 
   end if
   return s;  
end

JsonEvaluate is a function that returns the decoded value of a quoted JSON string.

I made this function just for fun, as I discovered this function as a standard FileMaker Custom Function. I found it on Brian Dunnings FileMaker Custom Functions Library.

I would like to see how this function would look like, implemented in the ACF language.

ACF plugin has its own datatype called JSON, and internaly in the plugin code we use nlohman JSON library that is a highly effective and versatile library.

We construct a JSON with a single tag as a text string, then parse it as we assign it to a JSON variable. Then we pull out the tag value, and remove quotes on each side of the text.

Back to List