Parse.com - JSON导入日期字段错误

时间:2014-10-14 03:53:32

标签: ios json date parse-platform

我正在尝试将一些JSON数据导入到Parse.com中的一个表中。这样做时,我收到以下错误:

导入时遇到以下错误:错误111:密钥startDate的无效类型,预期日期,但得到字符串

数据如下:

[
  {
    "title":"Software Webinar",
    "location":"Kingsview Financial",
    "host":"Josh Chase",
    "startDate":"10/13/2014 12:30",
    "EndDate":"10/13/2014 13:30",
    "eventType":"TA",
    "eventDescrioption":"Informative webinars on utilize and maximize all the features of the TA Trader platform."
  }
]

我对日期格式进行了修改,但无济于事。只是尝试导入一些数据,并且必须使用JSON数据来执行此操作。谢谢你的帮助。

1 个答案:

答案 0 :(得分:4)

像这样囚禁你的约会对象:

"startDate": {

    "__type": "Date",
    "iso": "2014-10-13T12:30:00.000Z"
}

你JSON看起来像这样:

[
  {
    "title":"Software Webinar",
    "location":"Kingsview Financial",
    "host":"Josh Chase",
    "startDate": {

        "__type": "Date",
        "iso": "2014-10-13T12:30:00.000Z"
    },
    "EndDate": {

        "__type": "Date",
        "iso": "2014-10-13T13:30:00.000Z"
    },
    "eventType":"TA",
    "eventDescrioption":"Informative webinars on utilize and maximize all the features of the TA Trader platform."
  }
]

希望这会有所帮助.. :)