Skip to content

[HttpFoundation] Make json options configurable in JsonResponse #9086

Closed
@hacfi

Description

@hacfi

I have a use case where I want to use the json_encode option JSON_UNESCAPED_SLASHES. I noticed that Symfony\Component\HttpFoundation\JsonResponse doesn’t allow to change the json options.

Would you accept a PR which allows you to change the options?

I was thinking about something like

$response = new JsonResponse();
$response->setOptions(JSON_UNESCAPED_SLASHES);
$response->setData($data);

or

JsonResponse::setOptions(JSON_UNESCAPED_SLASHES);
$response = new JsonResponse($data);

ping @igorw

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions