jsonLength (Function)

Signature: jsonLength(document: int, path: string) -> int

Description: Returns an array length or object member count at the given path, or -1 for an invalid path, handle, or scalar.

Parameters

  • document (int): Handle returned by jsonParse
  • path (string): Path to an array or object; empty means the root

Returns: int

Example

let n = jsonLength(doc, "items")
n = jsonLength (doc, "items")