
Zhris
User
Mar 21, 2013, 1:57 PM
Post #2 of 5
(146 views)
|
|
Re: [robertico] Parse JSON with PERL
[In reply to]
|
Can't Post
|
|
Hi, Use JSON from CPAN:
#!/usr/bin/perl use strict; use warnings FATAL => qw/all/; use JSON; use Data::Dumper; my $json_string = '{"to_id": 0, "message": "This is a sample", "message_id": 1000, "from_id": 999}'; my $json_object = JSON->new( ); my $perl_ref = $json_object->decode( $json_string ); print Dumper( $perl_ref ); Output:
$VAR1 = { 'from_id' => 999, 'message_id' => 1000, 'to_id' => 0, 'message' => 'This is a sample' }; Chris
(This post was edited by Zhris on Mar 21, 2013, 1:59 PM)
|