Hi I am using Symfony2 for my application. I am using the serializer component.
$encoder = new JsonEncoder();
$normalizer = new GetSetMethodNormalizer();
$callback = function ($dateTime) {
return $dateTime instanceof \DateTime
? $dateTime->format(\DateTime::ISO8601)
: '';
};
$normalizer->setCallbacks(array('matchAStartTime' => $callback, 'matchBStartTime'=> $callback, 'matchDate'=> $callback));
$normalizer->setIgnoredAttributes(array('createdAt', 'updatedAt'));
$serializer = new Serializer(array($normalizer), array($encoder));
$json = $serializer->serialize($entity, 'json');
but in the output i am having response like this:
\"id\":1,\"matchAStatus\":\"Live\"
my question is how can I remove that slash in output? I know in raw php there is option for escape backslash but what can I use in Symfony?