无法使用httpRequest JSON.Parse任何字符串

时间:2015-04-26 17:12:46

标签: json parse-platform

我有自己的网络服务,我从解析作业功能发出POST请求。

几天前,我完全能够Parse() JSON,现在我得到了一堆 [object Object] undefined 属性。我在网络服务上没有改变任何东西,我甚至试图回滚,但似乎都没有。

我的代码是什么样的:

Parse.Cloud.httpRequest({
      method: 'POST',
      url: 'http://MYWEBSERVICE.php',
      body: {
        userTia: jsoncontent,
        userPass: jsoncontent,
        userUnidade: jsoncontent
      },
      success: function(httpResponse) {
        console.log(httpResponse.text);
        var tiaJsonParsed = JSON.parse(httpResponse.text);
        console.log("Response: " + httpResponse.text);
        console.log("JsonParsed: " + tiaJsonParsed[1]);
        console.log("JsonParsed: " + tiaJsonParsed[1].nome)
      },
      error: function(httpResponse) {
        console.error('Request failed with response code ' + httpResponse.status);
      }
    });

httpResponse.text给了我一个有效的JSON,正是我所期望的。但所有那些console.logs都给了我:

[object Object]; 1: [object Object]; 2: [object Object]; 3: [object Object]; 4: [object Object]; 5: [object Object]; 6: [object Object]; 7: [object Object];

是的,它是一个带有对象的数组,这是正确的。但不应该是对象。

我甚至尝试过:

for (var property in tiaJsonParsed) {
   output += property + ': ' + tiaJsonParsed[property]+'; ';
}
console.log('OUTPUT:' + output);

未定义

var tiaJsonParsed = JSON.parse(JSON.stringify(httpResponse.data));
var tiaJsonParsed2 = JSON.parse(JSON.stringify(httpResponse.text));

它是一样的。

那么,我在这里做错了什么? Parse.com在本周和上周之间发生了什么变化吗?因为这突然停止了,我没有更多的想法。

0 个答案:

没有答案