in reply to How to insert a string unknown contents into json consistently?

This is how

use JSON; my %stuff = ( ro => "...", sham => "...", bo => "...anything here" ); my $json = JSON->new->utf8(1)->pretty(1)->encode( \%stuff ); print $json; __END__ { "ro" : "...", "bo" : "...anything here", "sham" : "..." }

Anything other than this is weak sauce :)

  • Comment on Re: How to insert a string unknown contents into json consistently?
  • Download Code

Replies are listed 'Best First'.
Re^2: How to insert a string unknown contents into json consistently?
by Anonymous Monk on Apr 22, 2015 at 04:00 UTC
    Sir,

    My recipe was indeed using the weakest of sauces. Your tip blew my mind. I shrunk my script to a quarter of its size, and it is a happy little json machine now. Much appreciated!!