perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:
my $json = { 'username' => 'foo', 'password' => 'bar', }; my $encoded = to_json($json); my $escaped = uri_escape($encoded); #string. my $query = '&inputparms='.$escaped; my $url = $rest_url.$query; print "$url\n"; my $response = $ua->post($rest_url); my $content = undef; if ($response->is_success) { $content = $response->content; }
my $input = $PARMS{inputparms}; print qq{Content-type: application/json; charset=utf8\n\n}; my $in = from_json( $input, {utf8 => 1} ); my $jsonDecode = encode_json($in); print "$jsonDecode\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print Json text from query string
by Corion (Patriarch) on Sep 10, 2012 at 10:47 UTC | |
by perlCrazy (Monk) on Sep 10, 2012 at 10:55 UTC | |
by Corion (Patriarch) on Sep 10, 2012 at 11:04 UTC | |
by perlCrazy (Monk) on Sep 10, 2012 at 11:11 UTC | |
by Corion (Patriarch) on Sep 10, 2012 at 11:21 UTC | |
| |
|
Re: Print Json text from query string
by rpnoble419 (Pilgrim) on Sep 10, 2012 at 17:12 UTC |