Using a type in place of a column definition list?
Use json_populate_record:

SELECT *
FROM json_populate_record(null::foo, '{"a":1,"b":2,"c":3,"d":4}')


The column matching is done by name, non-existing columns are silently ignored: 

create type other_foo as (a int, b int, x int, y int):
SELECT *
FROM json_populate_record(null::other_foo, '{"a":1,"b":2,"c":3,"d":4}');


returns:

a | b
--+--
1 | 2