'Compare two json values for equality
(Note that this is using the Preview JSON
feature in BigQuery.)
Is there a simple way to compare two json values to see if they're equal, ignoring key-ordering, recursively, for example:
{a: 1, b:2} === {b:2, a:1}
As an example:
WITH tbl AS (
SELECT JSON '{"a": 1, "b": 2}' as a, JSON '{"b": 2, "a": 1}' as b
) SELECT a,b, a=b?? FROM tbl
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mikhail Berlyant |