2015-11-13 39 views
0

我试图使用Parse Cloud Code和Firebase的REST API将Parse发送到Firebase的POST请求。Firebase“数据无效,无法解析JSON对象....”

Parse.Cloud.define("createChatRoom", function(request, response) { 

    Parse.Cloud.httpRequest({ 
    url: 'https://myapp.firebaseIO.com/' + '.json', 
    method: 'PUT', 
    body: {"hi": "hello"} 
    }).then(function(httpResponse) { 
     response.success("Successfully posted hello!"); 
    },function(httpResponse) { 
     response.error("failed to post hello" + httpResponse.text) 
    }) 
}) 

然而,这种代码使火力地堡与以下错误响应:

"Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names." 

我试图组合的多个用于body,包括的撇号,整数变化和完全移除支架。

任何想法?

回答

1

回答我的问题:

JSON用于火力地堡必须被包裹在单引号'

body: '{"hi": "hello"}'