Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

JsonMappingException: Could not find creator property with name #89

Open
shehaaz opened this issue Jul 13, 2017 · 0 comments
Open

JsonMappingException: Could not find creator property with name #89

shehaaz opened this issue Jul 13, 2017 · 0 comments

Comments

@shehaaz
Copy link

shehaaz commented Jul 13, 2017

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[JsonMappingException: Could not find creator property with name '

Add @JsonProperty to the all case classes to make this work.
(Json.mapper.readValue(inputJsonString, classOf[Order]))

Solution for Order. Add it to all other case Classes.
e.g:

case class Order @JsonCreator()(
  @(ApiModelProperty @field)(position=1)@JsonProperty("id")id: Long,
  @(ApiModelProperty @field)(position=2)@JsonProperty("petId")petId: Long,
  @(ApiModelProperty @field)(position=3)@JsonProperty("quantity")quantity: Int,
  @(ApiModelProperty @field)(position=4)@JsonProperty("shipDate")shipDate: Date,
  @(ApiModelProperty @field)(position=5)@JsonProperty("status")status: String
)

https://github.com/swagger-api/swagger-samples/blob/master/scala/scala-play2.4/app/models/Order.scala

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant