MVC::Neaf::View::JS - JSON-based view for Not Even A Framework.


See MVC::Neaf.

    use MVC::Neaf;

    # define route ...
    sub {
        return {
            # your data ...
            -view => 'JS',                 # this is the default as of 0.20
            -jsonp => 'my.jsonp.callback', # this is optional

Will result in your application returning raw data in JSON/JSONP format instead or rendering a template.


new( %options )

%options may include:

  • want_pretty - sort keys & indent output

  • want_sorted - sort keys (this defaults to want_pretty)

  • preserve_dash - don't strip dashed options. Useful for debugging.

render( \%data )

Returns a scalar with JSON-encoded data.


This module is part of MVC::Neaf suite.

Copyright 2016-2019 Konstantin S. Uvarin

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.