bigframes.bigquery.json_set#
- bigframes.bigquery.json_set(input: Series, json_path_value_pairs: Sequence[Tuple[str, Any]]) Series[source]#
Produces a new JSON value within a Series by inserting or replacing values at specified paths.
Warning
The JSON-related API parse_json is in preview. Its behavior may change in future versions.
Examples:
>>> import bigframes.pandas as bpd >>> import bigframes.bigquery as bbq
>>> s = bpd.read_gbq("SELECT JSON '{\"a\": 1}' AS data")["data"] >>> bbq.json_set(s, json_path_value_pairs=[("$.a", 100), ("$.b", "hi")]) 0 {"a":100,"b":"hi"} Name: data, dtype: extension<dbjson<JSONArrowType>>[pyarrow]
- Parameters:
input (bigframes.series.Series) – The Series containing JSON data (as native JSON objects or JSON-formatted strings).
json_path_value_pairs (Sequence[Tuple[str, Any]]) – Pairs of JSON path and the new value to insert/replace.
- Returns:
A new Series with the transformed JSON data.
- Return type: