Maintained with ☕️ by
IcePanel logo

Spanner supports equality and ordering comparisons on JSONB and JSON values

Share

Services

## Feature Feature Spanner supports equality and ordering comparisons on JSONB and JSON values. You can use these values in `GROUP_BY` and `ORDER BY` clauses without first converting them to another data type. In GoogleSQL, you can also convert other data types to`JSON` using `CAST(expression AS JSON)` and compare JSON values directly with non-JSON values. Spanner can implicitly coerces the non-JSON value to `JSON` for comparison. Additionally, you can use search indexes to accelerate equality comparisons such as `=` or `IN` on JSONB and JSON columns and subpaths. For more information, see[JSON comparison and sorting](https://cloud.google.com/spanner/docs/reference/standard-sql/data-types#comparison%5Fand%5Fsorting), [JSON comparison coercion](https://cloud.google.com/spanner/docs/reference/standard-sql/conversion%5Frules#json%5Fcomparison%5Fcoercion), [CAST AS JSON](https://cloud.google.com/spanner/docs/reference/standard-sql/conversion%5Ffunctions#cast%5Fas%5Fjson), [JSON search indexes](https://cloud.google.com/spanner/docs/full-text-search/json-indexes), and [Working with JSONB](https://cloud.google.com/spanner/docs/working-with-jsonb).