Created Mojo into Raw JSON sent list (markdown)
parent
a11f614345
commit
4785b94151
1 changed files with 52 additions and 0 deletions
52
Mojo-into-Raw-JSON-sent-list.md
Normal file
52
Mojo-into-Raw-JSON-sent-list.md
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
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.
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
$self->render( json => { success => Mojo::JSON->false }
|
||||||
|
'''
|
||||||
|
Sends as the JSON:
|
||||||
|
'''JSON
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
$self->render( json => { success => Mojo::JSON->true }
|
||||||
|
'''
|
||||||
|
Sends as the JSON:
|
||||||
|
'''JSON
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
$json->{ANYTHING}
|
||||||
|
'''
|
||||||
|
Extracts JSON data, so for example in this scenario it would get this JSON:
|
||||||
|
'''JSON
|
||||||
|
{
|
||||||
|
"ANYTHING": "SOMETHING",
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
And out of that would get the "SOMETHING" as text data.
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
$self->render( status => 403 );
|
||||||
|
'''
|
||||||
|
Sends as the JSON:
|
||||||
|
'''JSON
|
||||||
|
{
|
||||||
|
"status": 403,
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
my $json = $self->req->json;
|
||||||
|
'''
|
||||||
|
Extracts the HTTP request information of the JSON.
|
||||||
|
|
||||||
|
'''Perl
|
||||||
|
$self->render( status => 403 );
|
||||||
|
'''
|
||||||
|
Sends as an HTML 403 error.
|
Reference in a new issue