-
Notifications
You must be signed in to change notification settings - Fork 12
@JsonProperty
JonathanO edited this page Jun 3, 2012
·
2 revisions
Marks a getter/setter or a property for serialization/de-serialization. This must appear for every property you expect to be serialized/de-serialized.
Note that getters and setters must both be annotated if you expect marshalling to work in both directions.
- name (string) The name of the property in the JSON. Defaults to a guess based on the property/method name.
- type (string) The type of the property. Defaults to "string". See AnnotationTypes
<?
class Baz {
/**
* @JsonProperty(name="foo", type="integer")
*/
public $foo;
/**
* Name will default to bar.
* @JsonProperty(type="string")
*/
public function getBar() {
...
}
/**
* Slightly contrived.
* @JsonProperty(name="bar", type="string")
*/
public function setBaz($baz) {
...
}