separated render_json method