- var_dump: documentation ( source)
- json_decode: documentation ( source)
- preg_match: documentation ( source)
<?php
$json = '{
"code": "200002 - VALUE_TOO_LONG",
"title": "Der von Ihnen gepflegte Wert ist zu lang. K\u00fcrzen Sie die den Wert entsprechend der Zeichenbegrenzung aus der API-Dokumentation.",
"path": "\/products",
"jsonPath": "$.productVariations[?(@.sku==\"506163\")].productDescription.bulletPoints"
}';
$decode = json_decode($json, true);
$re = '/\$..*\[.*].(.*)/m';
preg_match($re, $decode['jsonPath'], $matches);
if (!empty($matches)) {
$field = $matches[1];
}
var_dump($field);