module Orion::Controller::JSONHelpers

Overview

JSON Response Helpers Simplified JSON rendering

Usage: get "/api/users" do json({users: all_users}) end

Direct including types

Defined in:

orion/controller/json_helpers.cr

Instance Method Summary

Instance Method Detail

def json(data, status : Int32 = 200) #

Render JSON response


[View source]
def json_accepted(data) #

[View source]
def json_bad_request(data) #

[View source]
def json_created(data, location : String | Nil = nil) #

[View source]
def json_forbidden(data) #

[View source]
def json_internal_server_error(data) #

[View source]
def json_not_found(data) #

[View source]
def json_ok(data) #

Render JSON with specific status


[View source]
def json_unauthorized(data) #

[View source]
def json_unprocessable_entity(data) #

[View source]
def jsonp(data, callback : String = "callback", status : Int32 = 200) #

Render JSONP response


[View source]