in reply to Re^10: json return value
in thread json return value
poj#!/usr/bin/env perl use strict; use warnings; use CGI (); use JSON::PP (); my $q = CGI->new; my $data = $q->param('POSTDATA') || '{"a":100,"b":300}'; my $json = JSON::PP->new->utf8; my $input = $json->decode( $data ); my $a = $input->{a}; my $b = $input->{b}; my $c = $a + $b; print $q->header("application/json"); print $json->encode({ c => $c });
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: json return value
by stenasc (Novice) on Jul 17, 2013 at 07:52 UTC | |
|
Re^12: json return value
by stenasc (Novice) on Jul 16, 2013 at 14:30 UTC |