<?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);
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
string(31) "productDescription.bulletPoints"