Skip to main content
JSON functions provide tools for querying, analyzing, and manipulating JSON data. All functions are available via fc.json.*.

jq

Applies a JQ query to a column containing JSON-formatted strings.
fc.json.jq(column: ColumnOrName, query: str) -> Column
column
ColumnOrName
required
Input column of type JsonType.
query
str
required
A JQ expression used to extract or transform values.
return
Column
A column containing the result of applying the JQ query to each row’s JSON input.
The input column must be of type JsonType. Use cast(JsonType) if needed to ensure correct typing.

Examples

df.select(fc.json.jq(fc.col("json_col"), ".user.name"))

get_type

Get the JSON type of each value.
fc.json.get_type(column: ColumnOrName) -> Column
column
ColumnOrName
required
Input column of type JsonType.
return
Column
A column of strings indicating the JSON type: "string", "number", "boolean", "array", "object", or "null".

Examples

df.select(fc.json.get_type(fc.col("json_data")))

contains

Check if a JSON value contains the specified value using recursive deep search.
fc.json.contains(column: ColumnOrName, value: str) -> Column
column
ColumnOrName
required
Input column of type JsonType.
value
str
required
Valid JSON string to search for.
return
Column
A column of booleans indicating whether the JSON contains the value.

Matching Rules

  • Objects: Uses partial matching - {"role": "admin"} matches {"role": "admin", "level": 5}
  • Arrays: Uses exact matching - [1, 2] only matches exactly [1, 2], not [1, 2, 3]
  • Primitives: Uses exact matching - 42 matches 42 but not "42"
  • Search is recursive: Searches at all nesting levels throughout the JSON structure
  • Type-aware: Distinguishes between 42 (number) and "42" (string)

Examples

df.select(fc.json.contains(fc.col("json_data"), '{"name": "Alice"}'))
# Matches: {"name": "Alice", "age": 30} and {"user": {"name": "Alice"}}

Build docs developers (and LLMs) love