Skip to content

Mojo into Raw JSON sent list

Finn edited this page Sep 5, 2016 · 3 revisions

Throughout the code, various repeated JSON is sent in Mojo/DBI to the client and inverse. Here is a list of what exact JSON they send or what it means.

$self->render( json => { success => Mojo::JSON->false }

Sends as the JSON:

{
  "success": false,
}
$self->render( json => { success => Mojo::JSON->true }

Sends as the JSON:

{
  "success": true,
}
$json->{ANYTHING}

Extracts JSON data, so for example in this scenario it would get this JSON:

{
  "ANYTHING": "SOMETHING",
}

And out of that would get the "SOMETHING" as text data.

my $json = $self->req->json;

Extracts the HTTP request information of the JSON.

$self->render( status => 403 );

Sends as an HTML 403 error.

Clone this wiki locally