in reply to Re^5: How to read Array
in thread How to read Array
I am new in Perl. I have trying to below query
my $json = Cpanel::JSON::Dump( { 'dns_records' => [ map { ( { 'dns_rec +ord' => $_ } ) } @dns_record ] } );
After that getting below array
[{"dns_records": [ {"dns_record":{"ip":"192.64.179.9","ttl":"86400","name +":"86400","hostname":"192.64.179.10","type":"A"}}, {"dns_record":{"ip":"192.64.179.10","ttl":"14404","nam +e":"14400","hostname":"127.0.0.1","type":"A"}}, {"dns_record":{"ip":"@","ttl":"86400","name":"86400"," +hostname":"aresstest.com","type":"MX","mx_priority":"0"}}, {"dns_record":{"ip":"mail","ttl":"14400","name":"14401 +","hostname":"aresstest.com","type":"CNAME"}}, {"dns_record":{"ip":"www","ttl":"14400","name":"14402" +,"hostname":"aresstest.com","type":"CNAME"}}, {"dns_record":{"ip":"ftp","ttl":"14400","name":"14403" +,"hostname":"aresstest.com","type":"CNAME"}}]}]
But I need below type of array
[{"dns_record":{"ip":"192.64.179.9","ttl":"86400","name":"86400","host +name":"192.64.179.10","type":"A"}}, {"dns_record":{"ip":"192.64.179.10","ttl":"14404","nam +e":"14400","hostname":"127.0.0.1","type":"A"}}, {"dns_record":{"ip":"@","ttl":"86400","name":"86400"," +hostname":"aresstest.com","type":"MX","mx_priority":"0"}}, {"dns_record":{"ip":"mail","ttl":"14400","name":"14401 +","hostname":"aresstest.com","type":"CNAME"}}, {"dns_record":{"ip":"www","ttl":"14400","name":"14402" +,"hostname":"aresstest.com","type":"CNAME"}}, {"dns_record":{"ip":"ftp","ttl":"14400","name":"14403" +,"hostname":"aresstest.com","type":"CNAME"}}]
Please guide.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: How to read Array
by hdb (Monsignor) on Jul 15, 2013 at 07:55 UTC | |
by sunilgame (Initiate) on Jul 15, 2013 at 08:33 UTC | |
by hdb (Monsignor) on Jul 15, 2013 at 08:47 UTC |