Make the json serializer compatible with PHP >= 5.3.0