SebMorris has asked for the wisdom of the Perl Monks concerning the following question:
Hi experts
I have recently started writing a new perl program for my up and coming website, I need to be able to analyse some JSON code from an external site. After trying for over an hour I cannot see any solution.
I'm getting the code from this url: http://steamcommunity.com/market/listings/440/Name%20Tag/render/?count=2&start=2&query=
here is a link to a JSON parser making it easier to read: http://json.parser.online.fr/
I ended up with this code.
use JSON::XS; use WWW::Mechanize; use HTTP::Cookies; use LWP::Simple;; use strict; use warnings; sub parse { my $code = get("http://steamcommunity.com/market/listings/440/" . +$crates{$_[0]} . "/render/?count=1&start=0&query="); my %json = decode_json $code; print %json{success}; }
As you may have guessed this is not working, I cant think of any other way to do it. I get these errors: syntax error at C:\Users\Seb\perl.pl line 26, near "%jso syntax error at C:\Users\Seb\perl.pl line 28, near "}"
Any help would be really greatly appreciated, thanks in advance Seb Morris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing JSON code.
by Your Mother (Archbishop) on May 17, 2014 at 19:10 UTC | |
by SebMorris (Novice) on May 17, 2014 at 19:14 UTC | |
|
Re: Parsing JSON code.
by Laurent_R (Canon) on May 17, 2014 at 21:24 UTC |