Thread String parsen (4 answers)
Opened by fasel at 2014-12-02 15:00

GwenDragon
 2014-12-02 15:26
#178646 #178646
User since
2005-01-17
14759 Artikel
Admin1
[Homepage]
user image
CPAN:JSON gibts dafür. ;)
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
my $data = <<'DATA';
{"foo":[
        {"a":"aA","b":"bA","c":"cA"},
        {"a":"aB","b":"bB","c":"cB"},
        {"a":"aC","b":"bC","c":"cC"}
]}
DATA

use JSON;

my $json        = JSON->new->utf8;
my $perl_scalar = $json->decode( $data );


Siehe https://metacpan.org/pod/JSON#decode_json

print $perl_scalar->{foo}[1]->{a};
ergibt dann:
aB
Last edited: 2014-12-02 15:31:24 +0100 (CET)

View full thread String parsen