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


In reply to Parsing JSON code. by SebMorris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.