-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Trying to store a string/boolean/integer in column with JSON datatype results in 400.
schema:
CREATE TABLE vehicles.cars
(
manufacturer varchar(50) not null,
car_id bigint primary key not null
constraint cars_car_id_uindex unique,
doors bigint default 5,
last_updated timestamptz default now(),
extra_details json default '{}'
);
Request:
curl -X 'POST'
'http://localhost:8010/cars'
-H 'accept: /'
-H 'Content-Type: application/json'
-d '{
"car_id": 100,
"manufacturer": "Tesla",
"doors": 5,
"last_updated": null,
"extra_details": "type=roadster"
}'
Response:
{
"timestamp": "2024-07-21T09:59:53",
"path": "/cars",
"message": "property 'extra_details' with value "type=roadster" is not a valid OBJECT",
"code": 400,
"errors": []
JSON datatype accepts: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', 'OBJECT', 'ARRAY'