Skip to content

[HttpFoundation] Make json options configurable in JsonResponse #9086

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy