refactor
proper escape postgresql query
json examples