2015-11-13 55 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"}'