var jsn=getAttr(ref,"json-data").toString();
console.log(jsn); //{test: true,stringtest:"hallo"}. it's OK.
JSON.parse(jsn); //Uncaught SyntaxError: Unexpected token s, line: line with JSON.parse;
我认为JSON.parse对这些数据做了一些不正确的事情。我试着删除stringtest:"hallo" -没有结果...另外,我认为我做错了什么,所以
我尝试使用包含双引号的URL值来解码json,但是我总是得到“给定的数据不是有效的JSON”。或“无效的URL字符串”。解码对象时出错。 let data = Data("""{ "contentUrl":"https://somedomain.come/folder/1-test_Romio's-\"Video-?hl=en-GB" }
""".utf8)
do {
let decoder = JSONDecoder()
let object = try decoder.de
我正在尝试从JSON字符串" object“创建一个JavaScript对象,但是它失败了,出现了错误:
"SyntaxError: JSON.parse: JSON.parse数据第1列第48列中对象的后置属性值为',‘或'}’
var jsobj = JSON.parse( '{"lineID":11,"siteID":3,"mystring":"this is a \"Test\" string with quotes"}' );
mystring是一个