Gossamer Forum
Home : General : Perl Programming :

JSON and Perl

Quote Reply
JSON and Perl
Hi all

A little help please if anyone has an idea.

From a post response on my site i have data returned in a JSON format how do i parse that to display as i would with perl ?

EG
HTTP POST request to http://www.server.com/api/reference/get

reference - the reference to fetch information for
username - their username used for the front end
password - their password used for the front end


Typical response:
{"status":"ok","data":{"reference":"HW452226","customer":{"name":"TEST IGNORE","address":{"location":"City of Bristol","postcode":"BS14TR"}},"vehicle":{"vrm":"","make":"LAND ROVER","model":"RANGE ROVER SP HSE TDV8 A","body":"ESTATE","trim":"-","engine":"3628"},"parts":[{"name":"TOOLS - OTHER","description":null,"quote":{"condition":"used","quoted":"1","price":"10.00","deliverytime":"24","guarantee":"90","mileage":"","fittingservice":"0","fittingprice":"0.00"}}]}}



I want to get this into the FORM data returned will need to be parsed eg
$name=$FORM{'name'};
$sname=$FORM{'sname'};

Any help please


Whistle
Thanks
Quote Reply
Re: [Syte] JSON and Perl In reply to
Maybe this is what you are looking for:

http://search.cpan.org/...SON-2.14/lib/JSON.pm