original_string: protected function json($data, int $status = 200, array $headers = [], array $context = []): JsonResponse
      {
          if ($this->container->has('serializer')) {
              $json = $this->container->get('serializer')->serialize($data, 'json', array_merge([
                  'json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS,
              ], $context));
  
              return new JsonResponse($json, $status, $headers, true);
          }
  
          return new JsonResponse($data, $status, $headers);
      }
code: protected function json($data, int $status = 200, array $headers = [], array $context = []): JsonResponse
      {
          if ($this->container->has('serializer')) {
              $json = $this->container->get('serializer')->serialize($data, 'json', array_merge([
                  'json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS,
              ], $context));
  
              return new JsonResponse($json, $status, $headers, true);
          }
  
          return new JsonResponse($data, $status, $headers);
      }
code_tokens: protected function json ( $ data , int $ status = 200 , array $ headers = [ ] , array $ context = [ ] ) : JsonResponse { if ( $ this -> container -> has ( 'serializer' ) ) { $ json = $ this -> container -> get ( 'serializer' ) -> serialize ( $ data , 'json' , array_merge ( [ 'json_encode_options' => JsonResponse :: DEFAULT_ENCODING_OPTIONS , ] , $ context ) ) ; return new JsonResponse ( $ json , $ status , $ headers , true ) ; } return new JsonResponse ( $ data , $ status , $ headers ) ; }
docstring: Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
  
  @final
docstring_tokens: Returns a JsonResponse that uses the serializer component if enabled or json_encode .