Sign in to follow this  
Followers 0
macjos

[Samples] read json custom function without plugin, FileMaker only

1 post in this topic

read json custom function without plugin, FileMaker only


Being unsatisfied with solutions I found on the internet and wanting a solution without plugin I created a set of custom functions that can read a path out of a json-string.

 

Syntax:

 

json_path ( json-string ; path )

 

 

examples:

 

json_path( $user_prefs ; "Privileges/Modules" )

json_path( $json_data ; "Menus/Menu[10]/MenuItem[5]/Label" )

 


  • Submitter
  • Submitted
    09/30/2016
  • Category
  • FM Version
    FM Version: 14

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By AlanTrewartha


      View File fmresultsetjson.xsl
      XSLT to convert Filemaker's REST web-service XML response into clean JSON
      https://twitter.com/alantrewartha
      2017-03-06
      Adapted from the original Six Fried Rice XSLT here http://sixfriedrice.com/wp/products/filemaker-to-json-converter/
      Changed:
      * single quotes to JSON-standard double-quotes
      * removed "fieldDefinitions" block (personal preference)
      * stopped every field value being presented as an [ array ] even when not a "repeating field"
      * added whitespace escaping code
      The white-space escaping code was entirely cribbed from
      https://github.com/doekman/xml2json-xslt/blob/master/xml2json.xsl
      Submitter AlanTrewartha Submitted 03/06/2017 Category Solutions FM Version FM Version: 0  
    • By AlanTrewartha
      XSLT to convert Filemaker's REST web-service XML response into clean JSON
      https://twitter.com/alantrewartha
      2017-03-06
      Adapted from the original Six Fried Rice XSLT here http://sixfriedrice.com/wp/products/filemaker-to-json-converter/
      Changed:
      * single quotes to JSON-standard double-quotes
      * removed "fieldDefinitions" block (personal preference)
      * stopped every field value being presented as an [ array ] even when not a "repeating field"
      * added whitespace escaping code
      The white-space escaping code was entirely cribbed from
      https://github.com/doekman/xml2json-xslt/blob/master/xml2json.xsl
    • By macjos
      Being unsatisfied with solutions I found on the internet and wanting a solution without plugin I created a set of custom functions that can read a path out of a json-string.
       
      Syntax:
       
      json_path ( json-string ; path )
       
       
      examples:
       
      json_path( $user_prefs ; "Privileges/Modules" )
      json_path( $json_data ; "Menus/Menu[10]/MenuItem[5]/Label" )
       
    • By Anthony
      I am using a custom function to format a number into currency format ( two decimals ). 
      RoundDecimals(11.0) = 11.00 The problems occurs when I use a variable:
      $amount = 11.0 RoundDecimals($amount) = 11.11 Similarly, I get the same error using a string:
      RoundDecimals("11.0") = 11.11  
      Is there any tricks to get around this issue ? 
      This is the custom function that I used (I replaced the comma for a dot and defaulted second parameter to 2):
      https://www.briandunning.com/cf/974