0
我正在玩Rails API服務器,我試圖將一個JSON對象傳遞給數據庫,但它保持導致一個空值。試圖通過json散列postgres json列結果爲空值
的模式很簡單:
create_table "notes", force: :cascade do |t|
t.string "title"
t.string "created_by"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.json "clients"
end
這是我在郵差
{
"created_by": "1",
"title": "I'm another note",
"clients": {
"client1": {
"name": "name 1",
"role": "role 1"
},
"client 2": {
"name": "name 2",
"role": "role 2"
}
}
}
正在張貼這種返回
{
"id": 14,
"title": "I'm another note",
"created_by": "1",
"created_at": "2017-06-14T10:52:00.226Z",
"updated_at": "2017-06-14T10:52:00.226Z",
"clients": null
}
如果我向客戶端發送鍵/值對作爲"clients": "some client"
它會寫沒有問題。我只是在郵差中傳遞錯誤的數據還是其他的東西?
完美的作品,非常感謝你! – oneWorkingHeadphone