Skip to main content

Description

Parses a JSON string and returns it as a list (array). Safely handles malformed JSON by returning an empty list on parse errors.

Syntax

Parameters

Returns

Type: list A list parsed from the JSON string. Returns an empty list [] if parsing fails or if the input is not a valid JSON array.

Examples

Example 1: Basic JSON Array Parsing

Output:

Example 2: Parsing Complex Arrays

Example 3: Processing Stored List Data

Example 4: Handling Malformed JSON

Output:
(Returns empty list for invalid JSON)

Notes

  • Returns empty list [] if input is not valid JSON
  • Returns empty list if the JSON represents a non-array value (e.g., object, string)
  • Safe to use without error handling as it won’t throw exceptions
  • Useful for parsing list data, batch imports, or stored JSON arrays

See Also

Frequently Asked Questions

It safely returns an empty list [] without throwing an exception, making it safe to use without error handling.
Yes. The function parses the full JSON structure including nested arrays and objects within the list elements.