$WBJSONLEN - length of JSON object

Availability
$WBJSONLEN is available for use with all WBSP commands.

Syntax
$WBJSONLEN{JSONSource|JSONArrayName}
$WBJSONLEN[JSONSource|JSONArrayName]

Parameters
JSONSource - String value containing JSON to be searched. Note that this is not an URL of the JSON file but JSON source itself.
JSONArrayName - The name of the array. Do not use brackets () or square brackets [] in array name. Note that JSON array names are case sensitive.


Returns
Number of elements of JSONArrayName.

Example

[FormFields]
wb_command=R
<!--WB_BeginTemplate-->
<html>
<head>
  <title>WBJSONLEN</title>
</head>
<body>
$wbsetv[JSON|$wbrinc[sample.json]]
Number of elements in "See also" array: $wbjsonlen[$wbgetv[json]|glossary.GlossDiv.GlossList.GlossEntry.GlossDef.GlossSeeAlso]
</body>
</html>

File Sample.json

{
    "glossary":
     {
      "title": "example glossary",
      "GlossDiv":
       {
        "title": "S",
        "GlossList":
         {
          "GlossEntry":
           {
            "ID": "SGML",
            "SortAs": "SGML",
            "GlossTerm": "Standard Generalized Markup Language",
            "Acronym": "SGML",
            "Abbrev": "ISO 8879:1986",
            "GlossDef":
             {
              "para": "A meta-markup language, used to create markup languages such as DocBook.",
              "GlossSeeAlso": ["GML", "XML"]
             },
            "GlossSee": "markup"
           }
         }
       }
     }
}

After running this example, the resulting page in browser should look like this:

Number of elements in "See also" array: 2