Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SerializerContextBuilder.php

function SerializerContextBuilder::withEmptyArrayAsObject

Configures whether an empty array should be transformed to an object (in JSON: {}) or to a list (in JSON: []).

File

vendor/symfony/serializer/Context/SerializerContextBuilder.php, line 30

Class

SerializerContextBuilder
A helper providing autocompletion for available Serializer options.

Namespace

Symfony\Component\Serializer\Context

Code

public function withEmptyArrayAsObject(?bool $emptyArrayAsObject) : static {
    return $this->with(Serializer::EMPTY_ARRAY_AS_OBJECT, $emptyArrayAsObject);
}
RSS feed
Powered by Drupal