[dancer-users] serialize

Hao Wu echowuhao at gmail.com
Thu Mar 19 19:18:28 GMT 2015


Hi,

read the doc here, please.

https://metacpan.org/pod/JSON#allow_blessed

you need implement TO_JSON method to your object.


On Thu, Mar 19, 2015 at 10:33 AM, Zahir Lalani <
ZahirLalani at oliver-marketing.com> wrote:

>  Hi
>
>
>
> In order work around the routing issue I posted earlier, I am trying to
> serialise the output but I get nulls.
>
>
>
> The dump of the output structure is:
>
> $VAR1 = [
>
>           bless( {
>
>                    'org_name' => 'Fashion',
>
>                    'id' => 3
>
>                  }, 'org_list_dom' ),
>
>           bless( {
>
>                    'org_name' => 'Market',
>
>                    'id' => 4
>
>                  }, 'org_list_dom' ),
>
>           bless( {
>
>                    'org_name' => 'Property',
>
>                    'id' => 5
>
>                  }, 'org_list_dom' ),
>
>           bless( {
>
>                    'org_name' => 'Misc',
>
>                    'id' => 6
>
>                  }, 'org_list_dom' )
>
>
>
> Passing this ($res)  into serialize:
>
>
>
>                my $json = to_json( $res, { allow_blessed => 1,
> convert_blessed => 1 } );
>
>
>
> gives
>
>
>
> [null,null,null,null]
>
>
>
> Any clues as to what I may be doing wrong?
>
>
>
> Z
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150319/b909e97d/attachment.html>


More information about the dancer-users mailing list