2

I have a url which should be invoked from my perl script with a specific parameter. On invoking the url it returns me a JSON. I will have to parse this JSON in the same script. What is the best way to get this done in perl. A pseudo code would be of help :)

1
  • 5
    Start with a trip to json.org and cpan.org (the former will redirect to the latter ;-) Now go "get the c0dez". Commented Mar 11, 2011 at 7:40

1 Answer 1

18

You can try something like this:

use LWP::Simple qw(get);
use JSON        qw(from_json);

my $url     = "http://example.com/get/json";
my $decoded = from_json(get($url));

See docs for LWP::Simple and JSON for more details.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.