Hallo,
ich bräuchte mal die Hilfe der Community.
Ich habe folgendes Jsonfile:
Ich möchte nun zum Beispiel den Status, die Timestamps, den String "Got handset with number......" etc. einzeln in eine Variable speichern. Ich habe schon mit folgenden PHP Code angefangen:
ich bräuchte mal die Hilfe der Community.
Ich habe folgendes Jsonfile:
Code:
[ { "uri": "features/complete_ski.feature", "id": "complete_ski_with_time", "keyword": "Feature", "name": "Complete_Ski_with_time", "description": "", "line": 1, "elements": [ { "id": "complete_ski_with_time;time_part_preamble", "keyword": "Scenario", "name": "time_part_preamble", "description": "", "line": 3, "type": "scenario", "before": [ { "output": [ "Default Timestamp start: 1516024716000" ], "match": { "location": "features/support/env.rb:32" }, "result": { "status": "passed", "duration": 191690 } }, { "match": { "location": "capybara-2.17.0/lib/capybara/cucumber.rb:13" }, "result": { "status": "passed", "duration": 52117 } }, { "match": { "location": "capybara-2.17.0/lib/capybara/cucumber.rb:21" }, "result": { "status": "passed", "duration": 25885 } } ], "steps": [ { "keyword": "Given ", "name": "a Android A-Party", "line": 4, "output": [ "Got handset with number unvisable, IMSI: notfor, android-Id: yourfone, VNC: 11111, port: 9981" ], "match": { "location": "features/step_definitions/idrp_steps.rb:11" }, "result": { "status": "passed", "duration": 1415024760 }, "after": [ { "match": { "location": "features/support/env.rb:24" }, "result": { "status": "passed", "duration": 264339 } } ] } ..................................................................
PHP-Code:
<?php
// phpinfo();
$jsonconntent = file_get_contents("/home/maxi/test1.json");
$data = json_decode($jsonconntent, true);
foreach ( $data as $item ) {
$Testcasename = $item['name'];
foreach ( $item['elements'] as $element ) {
// not possible $timestamp1 = $element['output'];
$type = $element['keyword'];
foreach ($element['before'] as $element1) {
}
}
}
?>
Kommentar