I need to remove all space before string and keep space in string and remove all space after string in array and keep the structure of array
$data = json_decode($json, true);
foreach($data as $index => $value){
$tables = json_encode($value["tables"], JSON_UNESCAPED_UNICODE);
echo $tables;
}
Result from echo $tables;
[{"lang":"cs","lang_title":"Český","menus":[{"header":"Mechanika","rows":[{"parameter":"Hmotnost","value":"0.65kg"}]}]},{"lang":"pl","lang_title":"Polský","menus":[{"header":"Mechanika nová","rows":[{"parameter":"Masa","value":"0.65kg"}]}]},{"lang":"en","lang_title":"Anglický","menus":[{"header":" Me chanics ","rows":[{"parameter":"Weight","value":"0.65kg"}]}]}]
And I need to keep the structure of $value["tables"] and just remove spaces in header,parameter,value
So example "header":" Me chanics " -> "header":"Me chanics"