Skip to content

nephia/Nephia-Plugin-JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Nephia::Plugin::JSON - A plugin for Nephia that provides JSON Response DSL

SYNOPSIS

use Nephia plugins => ['JSON'];
app {
    json_res +{ 
        name  => 'ytnobody',
        birth => '1980-11-11',
    };
};

DESCRIPTION

Nephia::Plugin::JSON provides three DSL that is about JSON.

CONFIG

enable_api_status_header

If you define it as true, json_res returns with 'X-API-Status' header.

use Nephia plugins => ['JSON' => {enable_api_status_header => 1}];
...

DSL

json_res $hashref

Returns a Nephia::Response that contains application/json contents.

encode_json $hashref

Returns JSON string of encoded hashref.

decode_json $json_str

Returns hashref of decoded JSON.

LICENSE

Copyright (C) ytnobody.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

ytnobody [email protected]

About

A plugin for Nephia that provides JSON Response DSL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages