Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID support #24

Closed
fommil opened this issue Oct 24, 2012 · 2 comments
Closed

UUID support #24

fommil opened this issue Oct 24, 2012 · 2 comments

Comments

@fommil
Copy link
Contributor

fommil commented Oct 24, 2012

Please add something like the following to BasicFormats: UUIDs are so widely used that they must be on par with some of the other types in that file.

trait UuidMarshalling {
  implicit object UuidJsonFormat extends JsonFormat[UUID] {
    def write(x: UUID) = JsString(x toString ())
    def read(value: JsValue) = value match {
      case JsString(x) => UUID.fromString(x)
      case x => deserializationError("Expected UUID as JsString, but got " + x)
    }
  }
}
@fommil
Copy link
Contributor Author

fommil commented Nov 3, 2012

see #25

@fommil fommil closed this as completed Nov 3, 2012
@natbusa
Copy link

natbusa commented Oct 11, 2014

Awesome, it worked perfectly. Thanks! ( I might make a second version for datetime conversion). This conversions are really all over the places, it makes sense to extend the json (un)marshalling with your own set of traits.

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

No branches or pull requests

2 participants