BE_JSON_ArraySize

BE_JSON_ArraySize ( json {; path } )

Will return the number of values in a JSON array.  If now path is included, it counts the array at the root of the JSON, and will return 1 for a non array type.  If a path is included, the format is as per the JSONPath function, which is NOT the same as the internal FileMaker JSON functions introduced in version 16.

Version : 2.1
Version : 4.1 : Added the optional path parameter.

Parameters :
json : the array to count.
path : the path within the JSON to locate the array to count.

Result : Returns the number of values in the array, or ? for an error. Other errors are logged and can be retrieved with BE_GetLastError.

Examples :

BE_JSON_ArraySize ( " [ { " &
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.