Skip to main content

isJsonArray() function

Determines whether a value is a JSON array.

Signature​

export declare function isJsonArray(value: unknown): boolean;

Parameters​

Parameter

Type

Description

value

unknown

The value to test.

Returns​

boolean

true if the value is a JSON array, false otherwise.

Remarks​

Validates that a value represents a JSON array, excluding undefined. This ensures the value is a proper array that could have been parsed from JSON.

Returns true for: any array, including empty arrays.

Returns false for: undefined, null, objects, and primitives.

The undefined check is important for distinguishing between optional properties that are missing (undefined) versus properties that are explicitly empty arrays. This is common in package.json where array fields may be absent or present but empty.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.