Postgresql 9.5 JSON problems
The problem was that the screening part of the query was out of sync with the current database.

The corrected version uses:

context::json as contextobj 


(like my effort)

WHERE typecode = 'IMAGERY'
    AND context != '  '
    AND r.createdon &gt; '1/1/2016'


I didn't have this part.