From d51a1893b85624c0d774a5e43fd9c66187dd7c4e Mon Sep 17 00:00:00 2001 From: Finn Date: Mon, 5 Sep 2016 18:18:57 +0100 Subject: [PATCH] Updated Mojo into Raw JSON sent list (markdown) --- Mojo-into-Raw-JSON-sent-list.md | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Mojo-into-Raw-JSON-sent-list.md b/Mojo-into-Raw-JSON-sent-list.md index a961282..b761426 100644 --- a/Mojo-into-Raw-JSON-sent-list.md +++ b/Mojo-into-Raw-JSON-sent-list.md @@ -1,52 +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 +```Perl $self->render( json => { success => Mojo::JSON->false } -''' +``` Sends as the JSON: -'''JSON +```JSON { "success": false, } -''' +``` -'''Perl +```Perl $self->render( json => { success => Mojo::JSON->true } -''' +``` Sends as the JSON: -'''JSON +```JSON { "success": true, } -''' +``` -'''Perl +```Perl $json->{ANYTHING} -''' +``` Extracts JSON data, so for example in this scenario it would get this JSON: -'''JSON +```JSON { "ANYTHING": "SOMETHING", } -''' +``` And out of that would get the "SOMETHING" as text data. -'''Perl +```Perl $self->render( status => 403 ); -''' +``` Sends as the JSON: -'''JSON +```JSON { "status": 403, } -''' +``` -'''Perl +```Perl my $json = $self->req->json; -''' +``` Extracts the HTTP request information of the JSON. -'''Perl +```Perl $self->render( status => 403 ); -''' +``` Sends as an HTML 403 error.