Furkan has asked for the wisdom of the Perl Monks concerning the following question:
I want to read out certain information out of that JSON File and I already found out how to read informations which contains data (f.e. "catalina_base"), but I also would like to read out the instance names ("instance_name" and "instance_name2"). The way I read out the informations containing data is by for example:{ "local": { "tomcat": { "general": { "catalina_home": "somewhere/tomcat/current", "install_dir": "somewhere/tomcat/8.5.20", "name": "Tomcat Web Application Server", "version": "1.8u131" } "instances" { "instance_name": { "catalina_base": "somewhere/tomcat_instances/instan +ce_name", "port" { "http": 18081, "https": 19081 }, "unix_group": "tmcuser", "unix_user": "tomcat1" }, "instance_name2": { "catalina_base": "somewhere/tomcat_instances/instan +ce_name2", "port" { "http": 18082, "https": 19082 }, "unix_group": "tmcuser", "unix_user": "tomcat2", } } } } }
How am I able to read out the instance name? If I try(...) my $data = decode_json($json); my $Catalina_Base = $data->{'local'}->{'tomcat'}->{'instances'}->{' +instance_name'}->{'catalina_base'}; (...)
I get every single information instance_name contains like catalina_base, port etc. but I just want the name of the instance. Is there any way to do that? I would be really thankful if you could help me. Greetings Furkan(...) my $data = decode_json($json); my $Instance_Name = $data->{'local'}->{'tomcat'}->{'instances'}->{' +instance_name'}; (...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading special parts of a JSON File
by choroba (Cardinal) on Sep 18, 2017 at 09:29 UTC | |
|
Re: reading special parts of a JSON File
by Eily (Monsignor) on Sep 18, 2017 at 09:26 UTC | |
by Furkan (Novice) on Sep 18, 2017 at 09:51 UTC | |
by Furkan (Novice) on Sep 18, 2017 at 09:32 UTC |