This extension is a wrapper of JavaScript implementation of JSONPath.
$ make
$ make install
$ psql -c "CREATE EXTENSION jsonpath;"
If you do now know about JSONPath specification, see official page.
- jsonPath(obj json, expr text) RETURNS json[]
SELECT jsonPath('{"x": {"a":1, "b":2}}'::json, '$.x.[a,b]');
jsonpath
----------
{1,2}
(1 row)