<?php
$json = '{
"Parameter1":"<style>
#label-9 {
display: block;
text-align: left;
color: #fff;
}
</style>",
"HistoryPosition":"1"
}';
// remove the newlines and replace them with the literal JS newline
$clean = str_replace(["\r", "\n"], ['', ''], $json);
var_dump(json_decode($clean));
- Output for 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- object(stdClass)#1 (2) {
["Parameter1"]=>
string(200) "<style> #label-9 { display: block; text-align: left; color: #fff; } </style>"
["HistoryPosition"]=>
string(1) "1"
}
preferences:
184.28 ms | 405 KiB | 217 Q