【发布时间】:2021-11-12 03:07:03
【问题描述】:
我想将一个对象添加到现有的 json 对象中:
我现有的 json 对象:
{
"id": 1,
"horaire_id": 1,
"json": "{"i": "idHoraire1-NumReservation1", "x": 3, "y": 2, "w":5, "h": 3, "j": 0}",
"num_reserv": 1,
"nombre_heures": 7.5,
"created_at": "2021-09-16T13:55:00.000000Z",
"updated_at": "2021-09-16T13:55:03.000000Z"
}
以及要插入到现有 json 对象中的对象:
{
"id": 1,
"evenement_type_id": 1,
"reservation_id": 1,
"posinreserv": 1,
"campus_id": 1,
"comment": null,
"created_at": null,
"updated_at": null
}
我们尝试了json_encode和json_decode,都没有成功:
$reservation = json_decode($reservation, true)
所有这些都使用 Laravel 7(不是 js)
谢谢。
【问题讨论】:
-
请添加您尝试过的代码
-
我刚刚添加了代码,谢谢。