开发者

parsing json with perl

开发者 https://www.devze.com 2023-02-16 00:12 出处:网络
I have a url which should be invoked from my perl 开发者_StackOverflow社区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.

I have a url which should be invoked from my perl 开发者_StackOverflow社区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 :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消