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

AI marketing workflows made simple

AI marketing workflows made simple

Featured
Markifact
Markifact

Verified Sponsor

Verified Sponsor

Markifact is a Verified Sponsor. Want to get featured here? Contact us.

Verified Sponsor
BigQuery ML Now Supports Llama and Mistral Models for Advanced Text Generation

BigQuery ML Now Supports Llama and Mistral Models for Advanced Text Generation

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 Metadata Caching for SQL Translation

BigQuery Introduces Metadata Caching for SQL Translation

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 Data Transfer Service adds Google Analytics 4 reporting support Trending ️‍πŸ”₯

BigQuery Data Transfer Service adds Google Analytics 4 reporting 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 Updates BigQuery with New Pipelines, Version Control, and Claude AI Integration

Google Updates BigQuery with New Pipelines, Version Control, and Claude AI Integration

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 Makes Analytics Hub Egress Controls and Data Clean Room Subscriptions Widely Available

BigQuery Makes Analytics Hub Egress Controls and Data Clean Room Subscriptions Widely Available

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 Data Transfer Service adds custom reports support for Google Ads

BigQuery Data Transfer Service adds custom reports support for Google Ads

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 Enhances Gemini in BigQuery with Python Code Completion

Google Enhances Gemini in BigQuery with Python Code Completion

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

Markifact logo

Markifact

Verified Tool

Verified Tool

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

Verified Tool

Marketing Workflows Powered by AI

Featured
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

Get Featured Here

Showcase your tool in this list.

Contact Us