You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use JMS\Serializer\Annotation as Serializer;
class Thingy {
/**
* @Serializer\Accessor(getter="getName")
* @Serializer\SerializedName(value="name")
* @Serializer\Expose
*/
private $name;
public function getName() {
return $this->name;
}
}
example serialization:
$thingy = new Thingy();
$result = $serializer->serialize($thingy, 'json');
var_dump($result);
result (JSON): []
expected result (JSON): {}
The text was updated successfully, but these errors were encountered:
This is a problem for JSON serialization wherein a JSON schema is defined and validated against.
For example:
example JSON schema:
example object:
example serialization:
result (JSON):
[]
expected result (JSON):
{}
The text was updated successfully, but these errors were encountered: