BE_JSON_Encode

BE_JSON_Encode ( key {; value ; type } )

 

Encodes a single value as JSON encoded text.

 

Notes and Limitations :

This function doesn't support binary data, booleans or arrays.  If you're looking for something more flexible please consider this :

https://github.com/geistinteractive/JSONCustomFunctions

The existing BE plugin based JSON functions will be deprecated in a future release.  It's undecided if they'll be replaced with something else or not, we haven't found a good set of viable replacements.

 

Version : 2.1

 

Parameters :
key : the name of the key value to encode.
value ( optional ) : The value of the key to encode.
type ( optional ) : The type is determined automatically from fields, but for text that you want to force to be a different type, use this parameter. Possible values are Boolean ( JSON True or False ), Text or Number ( JSON integer or real, but also includes FileMaker date, time or timestamp ). Any other values will error.

 

Result : Returns the encoded property as a string.

 

Examples :

BE_JSON_Encode ( "employees" ) // to just encode the name, so you can use that as an object name.

"{ " & BE_JSON_Encode ( "employees" ) & " [ { " &
BE_JSON_Encode ( "firstName" ; "John" ) & ", " & BE_JSON_Encode ( "lastName" ; "Doe" ) & " }, { " &
BE_JSON_Encode ( "firstName" ; "Anna" ) & ", " & BE_JSON_Encode ( "lastName" ; "Smith" ) & " }, { " &
BE_JSON_Encode ( "firstName" ; "Peter" ) & ", " & BE_JSON_Encode ( "lastName" ; "Jones" ) & " } ] }"

Have more questions? Submit a request

0 Comments

Article is closed for comments.