解析 php 中的多对象 json
parsing multi object json in php
大家好,我有以下样本数据,我想在 php 中解析它。您能否指导我如何获取以下数据中候选对象中 "plate" 和 "confidence" 的每个值。
$sample_data = [{"job_status": 3, "plates": {"data_type": "alpr_results", "epoch_time": 1430894595648, "img_height": 723, "img_width": 1280, "results": [{"plate": "RAC162R", "confidence": 90.876228, "region_confidence": 0, "region": "", "plate_index": 0, "processing_time_ms": 38.729237, "candidates": [{"matches_template": 0, "plate": "RAC162R", "confidence": 90.876228}], "img_height": 723, "img_width": 1280}]';
提前致谢
很简单,尝试使用json_decode($sample_data);
结果是php数组。
大家好,我有以下样本数据,我想在 php 中解析它。您能否指导我如何获取以下数据中候选对象中 "plate" 和 "confidence" 的每个值。
$sample_data = [{"job_status": 3, "plates": {"data_type": "alpr_results", "epoch_time": 1430894595648, "img_height": 723, "img_width": 1280, "results": [{"plate": "RAC162R", "confidence": 90.876228, "region_confidence": 0, "region": "", "plate_index": 0, "processing_time_ms": 38.729237, "candidates": [{"matches_template": 0, "plate": "RAC162R", "confidence": 90.876228}], "img_height": 723, "img_width": 1280}]';
提前致谢
很简单,尝试使用json_decode($sample_data);
结果是php数组。