From 30372475d351143cc4ec42d989075a68f8959c0c Mon Sep 17 00:00:00 2001 From: "Flavio W. Brasil" Date: Wed, 10 Sep 2014 08:01:46 -0300 Subject: [PATCH] docs - add jsonName example for the @Alias annotation --- activate-docs/spray-json.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/activate-docs/spray-json.md b/activate-docs/spray-json.md index c13a3018..e2ef80d3 100644 --- a/activate-docs/spray-json.md +++ b/activate-docs/spray-json.md @@ -62,4 +62,14 @@ There are methods to create or update entities based on a json: def createOrUpdateEntityFromJson[E <: Entity : Manifest](json: String): E def createOrUpdateEntityFromJson[E <: Entity : Manifest](json: JsObject): E ``` -If the json has an id, the entity is updated. Otherwise, a new entity is created. \ No newline at end of file +If the json has an id, the entity is updated. Otherwise, a new entity is created. + +## Field alias ## + +The @Alias annotation allows to define the "jsonName" to be used during the field serialization. + +Example: + +```scala +class Person(@Alias(value = "PERSON_NAME", jsonName = "name") name: String) extends Entity +``` \ No newline at end of file