我发送了一系列哈希值。
[{question_id: 1_id, answer:1_String},{question_id: 2_id, answer:2_String}]
我在我的API文件中使用了这段代码:
requires :profile_setting, type: Array[Hash], desc: "[{question_id: 1_id, answer: '1_String'},{question_id: 2_id, answer: '2_String'}]"
params:[{question_id: 1_id, answer:1_String},{question_id: 2_id, answer:2_String}]
回复:
{
"error": "profile_setting is invalid"
}
如何发送多个哈希数组。
答案 0 :(得分:1)
你的JSON错过了键和值的引号。
应该是
[{
"question_id": "1 _id",
"answer": "1 _String"
},
{
"question_id": "2 _id",
"answer": "2 _String"
}]