I have use JSON.parse(data.Body) it give me the correct result, which is an object.
Since I do npm run lint, it gives me error: 'You should use the angular.fromJson methof instead of JSON.parse
this is my code: this.$log.log(angular.fromJson(data.Body), JSON.parse(data.Body));
I can't understand what is the first output, Uint8Array?
What should I do to get the same results? I don't need the unsigned intergers.... The data.Body is just array of integers, but when I did JSON.parse, it's an Object
WHERE IS MY OBJECT?????!
答案 0 :(得分:2)
这里有一个很好的例子:
var strJSON =' {"名称":" mital&#34 ;, "年龄":25, "地址":"印度" }&#39 ;; 文件撰写(angular.fromJson(strJSON)); 文件撰写("&#34);答案 1 :(得分:1)
还有一个解决方案请添加angular.toJson而不是angular.fromJson。
以下是我的示例:var jsonData={
"links":[
{country: "india", state: "gujarat"}
]
document.write(angular.toJson(jsonData))