# JSON datatype vs JSON-like STRING in BigQuery


In [one my previous posts](https://datawise.dev/the-json-datatype-in-bigquery), we've briefly introduced the JSON datatype in BigQuery.

But did anyone notice how most of the JSON functions have signatures for both a JSON-type input and a json-formatted string input?

What is the difference between the two?

Well, I like to call the json-formatted STRING a "json-like string" because while it might look like it, it's not necessarily valid JSON.

When you use, say, JSON\_VALUE to query such a string, it does not validate it and reads it from the start until (and if) it finds the key matching your query. It does not care that you gave it invalid JSON.

In the example below, the json-formatted/json-like string is missing a closing bracket "}", but JSON\_VALUE using it still manages to retrieve the 'key' since it never reaches the missing bracket .

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1715087932426/155be5b0-29cf-4d10-ba65-869c3e3b2d97.jpeg align="center")

*Found it useful? Subscribe to my Analytics newsletter at* [*notjustsql.com*](http://notjustsql.com)*.*

---

*Enjoyed this? Here are some related articles you might find useful:*

- [The JSON datatype in BigQuery](https://datawise.dev/the-json-datatype-in-bigquery)
- [Flattening JSON arrays in BigQuery](https://datawise.dev/flattening-json-arrays-in-bigquery)
- [Extracting keys from JSON in BigQuery](https://datawise.dev/extracting-keys-from-json-in-bigquery)
- [LAX JSON conversion functions in BigQuery](https://datawise.dev/lax-json-conversion-functions-in-bigquery)

