As known, at the moment PostgreSQL has no method to compare two json values. The comparison like `json = json` doesn't work. But what about casting `json` to `text` before?

Then

```
select ('{"x":"a", "y":"b"}')::json::text = 
('{"x":"a", "y":"b"}')::json::text

```

returns `true`

while

```
select ('{"x":"a", "y":"b"}')::json::text = 
('{"x":"a", "y":"d"}')::json::text

```

returns `false`

I tried several variants with more complex objects and it works as expected.

Are there any gotchas in this solution?

**UPDATE:**

The compatibility with v9.3 is needed