如何使用JSON的Parse.Object?

时间:2016-01-20 16:16:19

标签: javascript parse-platform

我查看了文档:http://parse.com/docs/js/api/classes/Parse.Object.html#methods_fromJSON

我这样做了:Parse.Object.fromJSON(this.document),但我得到了:Uncaught Error: Cannot create an object without a className

使用此方法的正确方法是什么?

注意: console.log(this.document)输出:Object {}(之前已转换为toJSON的JSON对象的Parse对象。)

1 个答案:

答案 0 :(得分:3)

正如错误消息所示,您错过了["a", "a", " "] => [0, 1] ["a", "a", "c"] => [0, 1] [" ", "b", "b"] => [1, 2] ["a", "b", "b"] => [1, 2] ["c", " ", "c"] => [0, 2] ["c", "b", "c"] => [0, 2] ["c", "c", "c"] => [0, 1, 2] (在您的JSON中),告诉它它是什么类型的Parse对象。