Google BigQuery JSON Functions Simplified 101

Samuel Salimon • Last Modified: December 29th, 2022

bigquery json | Hevo Data

In most businesses, Data Warehouses are becoming the industry standard for storing data. For the businesses that utilize Google BigQuery, there are numerous options for exporting data and schemas to other systems and services. Converting the data to Google BigQuery JSON (Javascript Object Notation) format and exporting it is one popular option.

With Google BigQuery, businesses can run super-fast SQL queries on terabytes of data in seconds, without requiring any hardware or infrastructure. Google BigQuery remains one of the top enterprise Data Warehouse choices, allowing interactive analysis of large datasets. JSON is a standard text-based format for encoding structured data based on JavaScript object syntax. It is extensively used in Data Warehouses and web applications to transmit data.

This article will give you a comprehensive guide to the Google BigQuery JSON functions. You will get to know about Google BigQuery and JSON with their key features. You will also explore the data types, syntax, functions, and example queries of BigQuery JSON in the further sections. Let’s get started.

Table of Contents

What is Google BigQuery?

BigQuery JSON: Google BigQuery Logo | Hevo Data
Image Source

Google BigQuery is a cost-efficient multi-cloud Data Warehouse that is designed for the enhancement of business agility. It is a type of multi-cloud data that is highly scalable, serverless, effective, and allows for scalable analysis of Petabytes of data. Google BigQuery has an in-built Machine Learning capacity that supports querying using ANSI SQL and provides users with a storage of 10 Gigabytes and one Terabyte of query data processing per month.

Key Features of Google BigQuery

The key features of Google BigQuery are enormous, but some of the essential features include: 

  • Data Management: Google BigQuery is used to create and delete objects such as tables, views, and user-defined functions. It is also used to import data from Google storage in different formats such as CSV (Comma Separated Values), Parquet, Avro, or JSON.
  • SQL Queries: Google BigQuery is usually expressed in a standard SQL language. However, the results are often returned in JSON with a maximum response length of roughly 128 Megabytes, or even unlimited when enabling significant query results.
  • Data Integrations: Google BigQuery can be used as a bound script in Google Docs or any other language that works well with its REST API or clients’ libraries. 
  • Access Control: Google BigQuery can be used to share datasets with random persons, groups, or team members around the world.
  • Machine Learning models: Google BigQuery can create and implement Machine Learning models using SQL queries.

To know more about Google BigQuery, visit this link.

Load Real-time Data to Google Bigquery with Hevo’s No Code Data Pipeline

Hevo Data, a No-code Automated Data Pipeline empowers you to directly transfer structured and unstructured data from 100+ Data Sources (including 40+ sources) across Databases, SaaS Applications, Cloud Storage, SDKs, etc., to Google BigQuery Data Warehouse within minutes in a completely hassle-free manner. You can leverage Hevo’s Data Mapping feature to ensure that your Google BigQuery JSON data is up-to-date. It automatically modifies the data type of Google BigQuery table columns to accommodate Source data with different data types.

Get started with hevo for free

Hevo is fully managed and completely automates the process of not only loading data from your desired source but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Its fault-tolerant architecture ensures that the data is handled in a secure, consistent manner with zero data loss. Moreover, you can easily activate BigQuery data by connecting to a BI tool or business application to derive meaningful insights.

What is JSON?

BigQuery JSON: JSON Logo| Hevo Data
Image Source

JSON can be termed as a data interchange or an open standard file format that stores and transmits data objects. It consists of attribute-value pairs and other serializable values using a human-readable text to operate. It is a regular data format that involves different functionality ranges in data interchange and communication of web applications with servers. 

JSON is an independent language data format derived from JavaScript. It includes several modern programming languages or codes to generate and parse JSON format data and uses JSON to extend its filename.

Use Cases of JSON

Some of the key use cases of JSON include:`

  • JSON can be used while writing JavaScript-based applications that include websites and browser extensions.
  • It is used to serialize and transmit structured data over a network connection.
  • It is mainly used to transmit data from a server to web applications and vice-versa.
  • It is used to provide public data for Web services and APIs.
  • It is used with several modern programming languages.
  • It is easy to read and write.
  • It uses a text-based interchange format that is lightweight.
  • It is language-independent and functions well with different languages.

To know more about Google BigQuery JSON, visit this link.

What is JSON Syntax?

JSON syntax is fundamentally considered as an aspect or subset of JavaScript syntax; it includes:

  • The representation of data in key/value pairs.
  • A comma separates the key/value pairs by holding objects with curly braces and following each key with a colon.
  • A comma separates arrays as well by holding them with square brackets.

Data Types in Google BigQuery JSON

There are several data types in Google BigQuery JSON, but the main data types include:

1) Number

This is a double-precision floating-point format in JavaScript, which depends mainly on implementation. This format does not include the use of octal and hexadecimal formats.

Types of Numbers

  • Integer:  These are numbers or digits from 0 to 9, either positive or negative but do not include fractions or decimals.
  • Fraction: These are numbers that include fractions or decimals, either positive or negative.
  • Exponent: These are numbers that include exponents like e, e+, e-, E, E+, E-.

Syntax: var json-object-name = { string : number_value, …….}

For example, Numbers are displayed as:

var obj = {marks: 97}

2) String

This is a sequence of zero or more double Unicode characters that are quoted with escaping backslashes.

Types of Strings

  • Double quotation: ““”
  • Backslash: “”
  • Forward slash: “/.”
  • Backspace: “b”
  • Form feed: “f”
  • Newline: “n”
  • Carriage return: “r.”
  • Horizontal tab: “t.”
  • Four hexadecimal digits: “u.”

Syntax: var json-object-name = { string : “string value”, …….}

For example, String can be displayed as:

var obj = {name: 'Amit'}

3) Boolean

Boolean, in simple terms, includes either true or false values.

Syntax: var json-object-name = { string : true/false, …….}

For example, Boolean data types can be displayed as:

var obj = {name: 'Amit', marks: 97, distinction: true}

4) Array

This can be described as an ordered collection of values. They are enclosed in square brackets, meaning that arrays generally begin with “[” and end with “]”. The values in the brackets are separated by a comma and should be used when the key names are sequential integers.

Syntax: [ value, …….]

For example, an array of multiple objects is displayed as:

"books": [
              { "language":"Java" , "script":"second" },
              { "language":"C++" , "lastName":"fifth" },
              { "language":"C" , "lastName":"third" }

5) Object

This can be described as a set of key/value pairs that are not in order. Items are enclosed in curly braces; this means that the object starts with ‘{‘ and ends with ‘}’. A colon follows each name in the braces, and a comma separates the key/value pairs.

Objects are mainly used when the key names are arbitrary strings, and the keys must be strings and must be different from each other.

Syntax: { string : value, …….}

For example, the Object is displayed as:

    "id": "011A",
    "language": "JAVA",
    "price": 500,

6) Whitespace

This can be inserted between any pair of tokens to make codes more readable. 

Syntax: {string:” “,….}

For example, Whitespace can be displayed as:

var obj1 = {"name": "Sachin Tendulkar"}

7) Null

This can be described as a blank or empty entry.

Syntax: null

For example, Null can be displayed as:

var i = null;

The data types in BigQuery JSON are described in the table below.

NumberIt is a double-precision floating-point format in JavaScript.
StringIt is a double-quoted Unicode with backslash escaping.
BooleanTrue or False.
ArrayAn ordered sequence of values.
ValueIt can be a string, a number, true or false, null, etc.
Object An unordered collection of key-value pairs.
WhitespaceIt can be used between any pair of tokens.
Data Types in Google BigQuery JSON

What Makes Your Data Integration Experience With Hevo Best-in-Class?

These are some other benefits of having Hevo Data as your Data Automation Partner:

  • Exceptional Security: A Fault-tolerant Architecture that ensures Zero Data Loss.
  • Built to Scale: Exceptional Horizontal Scalability with Minimal Latency for Modern-data Needs.
  • Built-in Connectors: Support for 100+ Data Sources, including Databases, SaaS Platforms, Files & More. Native Webhooks & REST API Connector available for Custom Sources. Directly transfer data from your sources to BigQuery with our no-code BigQuery Connector.
  • Data Transformations: Best-in-class & Native Support for Complex Data Transformation at fingertips. Code & No-code Flexibility is designed for everyone.
  • Smooth Schema Mapping: Fully-managed Automated Schema Management for structured and even unstructured JSON data with the desired destination.
  • Blazing-fast Setup: Straightforward interface for new customers to work on, with minimal setup time.

Leverage Hevo’s blazing-fast Data Pipeline solution to help you seamlessly extract, transform, and load data to your BigQuery Data Warehouse in a matter of minutes! All this without writing any code. Try our 14-day full access free trial !!

Sign up here for a 14-day free trial!

Google BigQuery JSON Functions

Google BigQuery JSON has varied functions depending on the purpose for which it is used. Still, some of its primary functions are explained in the table below with its description and return types.

JSON FunctionDescriptionReturn Type
JSON_QUERYIt extracts a JSON value, such as an array or object, or a JSON scalar value, such as a string, number, or boolean. JSON-formatted String
JSON_VALUEExtracts a scalar value. A scalar value can be used instead of a string, number, or boolean. Unescapes the values and the outermost quotes are also removed. If a non-scalar value is selected, it returns a SQL NULL.String
JSON_QUERY_ARRAYExtracts an array of JSON values, including arrays and objects, as well as JSON scalar values like characters, numbers, and booleans.Array<JSON-formatted String> 
JSON_VALUE_ARRAYExtracts an array of scalar values. A scalar value can be used instead of a string, number, or boolean. It also unescapes the values and the outermost quotes are also removed. If the selected value is not an array or an array with just scalar values, it returns a SQL NULL.Array<String>
Google BigQuery JSON Functions

Best Practices for Loading JSON Files from Cloud Storage

BigQuery JSON: Best Practices for Loading JSON Files from Cloud Storage | Hevo Data
Image Source

When you are ready to load a new line delimited JSON data from Cloud Storage, the data should be loaded into a new partition or table. You can also decide to add to or even overwrite an existing table or section. After loading your data into Google BigQuery, it will be converted into a columnar format for the Capacitor, also called Google BigQuery’s storage format.

When a set of data is loaded from Cloud Storage into a Google BigQuery table, it is essential to ensure that the dataset that contains the table is in the exact regional or multi-regional location as the bucket of the Cloud Storage.

While loading a JSON file into Google BigQuery, it is imperative to note the following:

  1. The JSON data must be newline delimited. 
  2. Each JSON object that you are loading must be on a separate line in the file.
  3. Loading compressed JSON data into Google BigQuery is usually slower than loading data that is not compressed. If the data is compressed using the gzip compression, it would not be readable by Google BigQuery.
  4. A compressed file cannot be loaded together with another file that is not compressed in the same job.
  5. You cannot load a gzip file that is more than 4 gigabytes at once.
  6. Maps or dictionaries are not allowed in Google BigQuery due to possible lack of schema information in a pure JSON dictionary. For example, when you want to represent a list of products in a cart it should be represented as “products”: [{“product_name”: “my_product”, “amount”: 40.0} or {“product_name”: “product2”, “amount”: 16.5}] 
  7. When a CSV or JSON data is being loaded, it is vital to ensure that values in DATE columns are separated using the dash (-) as a separator. The date must be written in YYYY-MM-DD format.


This article provided an introduction to Google BigQuery JSON functions. You got a deeper understanding of Google BigQuery JSON and various use cases. You also got to know about the key data types, syntax, and example queries of JSON. Now, you can easily utilize Google BigQuery JSON to perform your desired tasks in Google BigQuery.

Now, building an in-house solution to assemble your JSON data from multiple sources into Google BigQuery will require a lot of time, money, and resources. Moreover, such a solution will require skilled engineers and regular maintenance.

Hevo Data is a No-code alternative to load JSON data from 100+ sources (40+free sources) to Bigquery in a fully automated manner without any manual intervention. Furthermore, for a range of Data Sources, Hevo provides a fully-managed, pre-configured Google BigQuery Data Warehouse to enable you to create your Pipelines without a hitch. It will make your life easier and make data migration hassle-free.

Learn more about Hevo

Share your experience of learning about Google BigQuery JSON functions in the comments section below!