Jquery 以RGB格式保存颜色时出现JSON错误
我到处搜索都找不到答案,或者这只是我的json代码中的错误Jquery 以RGB格式保存颜色时出现JSON错误,jquery,json,rgb,Jquery,Json,Rgb,我到处搜索都找不到答案,或者这只是我的json代码中的错误 JSON file: { "html": { "content": "<div style=\"background-color: rgb(255, 255, 255); height: 11px; width: 111px;\"></div>" } } background-color: rgb(255, 255, 255); --> NO background-color: #0000
JSON file:
{
"html": {
"content": "<div style=\"background-color: rgb(255, 255, 255); height: 11px; width: 111px;\"></div>"
}
}
background-color: rgb(255, 255, 255); --> NO
background-color: #000000; --> OK
它不能保存为RGB格式吗
但是如果我使用十六进制格式,json文件就完全可以了 它看起来不像jsonfile@JimiDini很抱歉这只是json文件中的一段简短代码!还是不明白。您是如何从这个html字符串创建JSON的?显示确切的JSON示例。您对生成的JSON做了什么?您有什么错误?因为它似乎对我有用(至少在解码部分)
$jsonPathSite = '/site/01.json';
$jsonFileSite = file_get_contents($jsonPathSite);
$jsonReadSite = jsonDecode($jsonFileSite,true);
// Saving the file
$jsonReadSite['html']['content'] = $content;
file_put_contents( $jsonPathSite, json_encode($jsonReadSite) );