BigQuery Introduces JSON_KEYS Function to Extract Unique Keys

August 12, 2024 at 6:56:46 AM

TL;DR Google has introduced the JSON_KEYS function in BigQuery, currently in Preview, to extract unique keys from JSON expressions. Key features include JSON_KEYS(json_expr[, max_depth[, mode]]), modes like strict, lax, and lax recursive, and returning an array of de-duplicated keys in alphabetical order, excluding array indices. It maintains case sensitivity and handles null values. This update aims to enhance BigQuery's JSON processing capabilities.

BigQuery Introduces JSON_KEYS Function to Extract Unique Keys

Google has announced the introduction of the JSON_KEYS function in BigQuery, currently available in Preview. This new function extracts unique keys from a JSON expression, offering developers more tools for JSON data manipulation.

Key features of JSON_KEYS

  1. Function Signature: JSON_KEYS(json_expr[, max_depth[, mode]])

  2. Arguments:

    • json_expr: JSON input
    • max_depth: Maximum depth of nested fields to search (optional)
    • mode: Determines key extraction behavior (optional)

Example:

SELECT JSON_KEYS(JSON '{"a": {"b":1}}', 1) AS json_keys
  1. Modes:

    • strict (default): Ignores keys in arrays
    • lax: Includes keys in non-consecutively nested arrays
    • lax recursive: Returns all keys
  2. Return Type: ARRAY

  3. Behavior:

    • Returns de-duplicated keys in alphabetical order
    • Excludes array indices
    • Escapes keys with special characters using double quotes
    • Maintains case sensitivity
  4. Null Handling:

    • Returns NULL if json_expr or mode is NULL
    • Ignores max_depth if it's NULL

Additionally, Google has introduced mode options for some JSON functions that use JSONPath, allowing for more flexible matching of JSON data structures.

This update aims to enhance BigQuery's JSON processing capabilities, potentially simplifying complex data operations for developers working with JSON-structured data.

Have more questions on this topic? Ask our AI assistant for in-depth insights.

Read more from sources 👇

The Only Digital Marketing Feed You'll Ever Need.

Stay informed your way. Tailored updates when and how you want them. 100% Free.

10,000+ Users

500+ Sources

1000+ Tools

Or

Related Posts

Google Cloud Code Extension Adds BigQuery Support in VS Code

Google Cloud Code Extension Adds BigQuery Support in VS Code

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
BigQuery Introduces Commercial Data Sharing via Cloud Marketplace

BigQuery Introduces Commercial Data Sharing via Cloud Marketplace

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Tired of spending too much time creating audits for your clients?

Tired of spending too much time creating audits for your clients?

Featured
Google Sheets Integrates BigQuery Saved Queries

Google Sheets Integrates BigQuery Saved Queries

Google
Google

Official Source

Official Source

Google is a Official Source. The source has been verified by Swipe Insight team.

Official Source
BigQuery Expands Search Index Capabilities with INT64 and TIMESTAMP Support

BigQuery Expands Search Index Capabilities with INT64 and TIMESTAMP Support

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Google Ends Free Access to Gemini in BigQuery, Announces Paid Plans

Google Ends Free Access to Gemini in BigQuery, Announces Paid Plans

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Google Cloud Enhances Looker with Major User Experience Updates

Google Cloud Enhances Looker with Major User Experience Updates

Sean Zinsmeister
Sean Zinsmeister

Official Source

Official Source

Sean Zinsmeister is a Official Source. The source has been verified by Swipe Insight team.

Official Source
BigQuery Launches Gemini-Enhanced SQL Translation Features

BigQuery Launches Gemini-Enhanced SQL Translation Features

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source

Related Tools

Marketing Auditor logo

Marketing Auditor

Verified Tool

Verified Tool

Marketing Auditor is a Verified Tool. Want to get this badge? Contact us.

Verified Tool

Automated audits for Google Ads and Analytics.

Get Featured Here

Showcase your tool in this list.

Contact Us
Databricks logo

Databricks

Generative AI-powered data intelligence platform

Data Engineering
GA4 SQL logo

GA4 SQL

Verified Tool

Verified Tool

GA4 SQL is a Verified Tool. Want to get this badge? Contact us.

Verified Tool

Generate GA4 BigQuery queries easily

Data Analysis
TapClicks logo

TapClicks

Automated marketing solutions powered by your data

Data Engineering
Stitch logo

Stitch

Automated cloud data pipelines, no coding needed

Data Engineering
Akkio logo

Akkio

AI-powered analytics for agencies

Data Analysis
NinjaCat logo

NinjaCat

AI-powered marketing data and analytics platform

Reporting
Funnel logo

Funnel

Aggregate and analyze marketing data seamlessly

Reporting
Fivetran logo

Fivetran

Effortlessly centralize and move data from any source

Data Engineering
Power My Analytics logo

Power My Analytics

Automate and integrate your marketing data

Reporting

Get Featured Here

Showcase your tool in this list.

Contact Us