Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink DataFrame
  • PyFlink Common
  • API Reference
  • PyFlink Table
  • Expressions
  • pyflink.table.expressions.json_array

pyflink.table.expressions.json_array#

json_array(on_null: JsonOnNull = JsonOnNull.ABSENT, *args) → Expression[source]#

Builds a JSON array string from a list of values.

This function returns a JSON string. The values can be arbitrary expressions. The on_null behavior defines how to treat NULL values.

Elements which are created from another JSON construction function call (json_object, json_array) are inserted directly rather than as a string. This allows building nested JSON structures.

Examples:

>>> json_array() # '[]'
>>> json_array(JsonOnNull.NULL, 1, "2") # '[1,"2"]'

>>> # Expressions as values
>>> json_array(JsonOnNull.NULL, col("orderId"))

>>> json_array(JsonOnNull.NULL, null_of(DataTypes.STRING()))   # '[null]'
>>> json_array(JsonOnNull.ABSENT, null_of(DataTypes.STRING())) # '[]'

>>> json_array(JsonOnNull.NULL, json_array(JsonOnNull.NULL, 1)) # '[[1]]'

See also

json_object()

Added in version 1.12.0.

previous

pyflink.table.expressions.json_object_agg

next

pyflink.table.expressions.json_array_agg

On this page
  • json_array()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.