Last active
January 2, 2016 21:49
-
-
Save tianon/8365844 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::JSON; | |
my $json = Mojo::JSON->new; | |
my $str = '{"some":"json","more":"stuff"}'; | |
my $obj = $json->decode($str); | |
$obj->{some} = 'changed'; | |
$obj->{new} = 'brand new!'; | |
delete $obj->{more}; # remove that nonsense | |
$str = $json->encode($obj); # or, $self->render(json => $obj); | |
print $str; # {"new":"brand new!","some":"changed"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice!