I am trying to manipulate a JSON file with PHP and am encountering the problem, that the function
$json = json_encode($cd, JSON_UNESCAPED_UNICODE);
is not working properly.
Code:
<?php
$contents = file_get_contents('file.json');
$ut= utf8_encode($contents);
$cd = json_decode($ut, true);
$cd['File'][0]['Name']="AnotherName";
$json = json_encode($cd, JSON_UNESCAPED_UNICODE);
file_put_contents('general.json', $json);
?>
The manipulating is working, however there are some ä,ö,ü and / symbols, which are changed to ä... and / in the output file. Is there any way to fix that?
Thanks