http://qs321.pair.com?node_id=1219718

mijares93 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am new to Perl and i want to parse a JSON File, but right now i am stuck.

Right now i am able to extract data from "observations"->"op_path" which results in: "Lib::Execution", but i want to access to the "status" and extract "kind", "path", "info"

The way i am extracting the data from "observations"->"op_path" is like this

my $decoded = decode_json($json); my $aref = $decoded->{"observations"}; foreach my $element (@$aref){ $final .= $element->{"op_path"}.","; } print $final;

The json file is the following one:

{ "generation_date": "", "static_info": "", "justification_files": [], "test_procedure_files": [ "" ], "observations": [ { "op_path": "Lib::Execution", "c_op_name": "Lib", "mono_info": "", "status": [ { "kind": "I", "path": "_L7=", "info": "%(MinorFrameCnt)%", "stat": "O" }, { "kind": "I", "path": "_L2=", "info": "%(Offset)%", "stat": "O" }, { "kind": "I", "path": "_L1=", "info": "%(Period)%", "stat": "O" }, { "kind": "I", "path": "_L6=-1", "info": "%(_L3)% = _L8", "stat": "O" }, { "kind": "I", "path": "_L6=-2", "info": "_L3 = %(_L8)%", "stat": "O" } ] }

Hope that you guys could help me with this issue