Json Unmarshal Error in POST Request #2084
cyberkryption
started this conversation in
General
Replies: 1 comment 6 replies
-
I did not test but curl -X 'POST' \
'http://localhost:8080/api/v1/licence' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"Discount": 0,
"Licence_num": 0,
"License_holder": "cyberkryption",
"License_id": "1234",
"License_type": "test",
"Price": 20.00,
"Validity": 365,
"createdAt": "2022-01-30T08:25:36.8471179Z",
"deletedAt": "2022-01-30T08:25:36.8471179Z",
"id": 0,
"updatedAt": "2022-01-30T08:25:36.8471179Z"
}' and you if err := (&echo.DefaultBinder{}).BindBody(c, &body); err != nil { |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am looking for some help. I am building an API with Swagger,Echo and Gorm 2.0
Code for reference at https://github.com/cyberkryption/licence-server
Struct
Reference request
When I try to bind to the body in the POST request at
I get an json unmarshall error shown below
Interestingly, the swagger api seems to think it is a string?

Can anyone help me understand this please? Is there a problem with my structs in model.go or swagger spec?
Beta Was this translation helpful? Give feedback.
All reactions