Skip to content

Commit

Permalink
docs - add jsonName example for the @alias annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Sep 10, 2014
1 parent f756f46 commit 3037247
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion activate-docs/spray-json.md
Expand Up @@ -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.
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
```

0 comments on commit 3037247

Please sign in to comment.