Skip to content

[HttpFoundation] Make json options configurable in JsonResponse #9086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hacfi opened this issue Sep 20, 2013 · 0 comments
Closed

[HttpFoundation] Make json options configurable in JsonResponse #9086

hacfi opened this issue Sep 20, 2013 · 0 comments

Comments

@hacfi
Copy link
Contributor

hacfi commented Sep 20, 2013

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

fabpot added a commit that referenced this issue Jan 7, 2014
…tions (stloyd)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[HttpFoundation] Add ability to change JSON encoding options

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Tests pass?   | yes
| Fixed tickets | #9086
| License       | MIT

Commits
-------

89f4784 [HttpFoundation] Add ability to change JSON encoding options
@fabpot fabpot closed this as completed Jan 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants