jsonGetArrayCount

Returns the number of elements in a JSON array field. Takes json string and key string. Returns count, or 0 if key not found or not an array.

JSON

Parameters & Returns

Parameters

json String
key String

Returns

Int

Quick Summary

Returns the number of elements in a JSON array field. Takes json string and key string. Returns count, or 0 if key not found or not an array.

Technical Exegesis...

Returns the number of elements in a JSON array field. Takes json string and key string. Calls FindKeyPosition to locate array field. If key not found, returns 0. Gets position after colon. Expects opening bracket '['. Skips opening bracket. Counts elements by tracking commas, objects, and values while respecting nested depth. Uses depth counter to track nested objects/arrays (increments on '{' or '[', decrements on '}' or ']'). Uses inString flag to track quoted strings (toggles on '\"').

Example

Example.bam
; No example implemented yet