我必须将以下字符串(t work.
i
)转换为JSONObject。由于某种原因,它正在失败。其他答案建议在双引号之前添加反斜杠,但是我的字符串已经有斜杠,但是仍然无法正常工作。
这里<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "*"
Header set Access-Control-Allow-Methods "GET,POST,PUT,OPTIONS,DELETE"
</IfModule>
是String变量,它包含以下字符串格式的JSON对象。
extract
这是我尝试将字符串转换为JSONObject的代码。
extract
我遇到以下异常:
"{
\"images\":
[
{
\"lines\":
[
{
\"text\":\"You remember things better\",
\"words\":
[
{
\"confidence\":\"high\",
\"text\":\"You\"
},
{
\"confidence\":\"high\",
\"text\":\"remember\"
},
{
\"confidence\":\"high\",
\"text\":\"things\"
},
{
\"confidence\":\"low\",
\"text\":\"better\"
}
]
},
{
\"text\":\"when you write them down\",
\"words\":
[
{
\"confidence\":\"high\",
\"text\":\"when\"
},
{
\"confidence\":\"high\",
\"text\":\"you\"
},
{
\"confidence\":\"high\",
\"text\":\"write\"
},
{
\"confidence\":\"high\",
\"text\":\"them\"
},
{
\"confidence\":\"high\",
\"text\":\"down\"
}
]
},
{\
"text\":\"BY\",
\"words\":
[
{
\"confidence\":\"high\",
\"text\":\"BY\"
}
]
},
{
\"text\":\"hand .\",
\"words\":
[
{
\"confidence\":\"high\",
\"text\":\"hand\"
},
{
\"confidence\":\"high\",
\"text\":\".\"
}
]
},
{
\"text\":\"Here\u0027s why.\",
\"words\":
[
{
\"confidence\":\"low\",
\"text\":\"Here\u0027s\"
},
{
\"confidence\":\"high\",
\"text\":\"why.\"
}
]
}
],
\"status\":\"Succeeded\"
}
]
}"