public function withJsonBody($data, SerializationContext $context = null)
    {
        if (is_string($data)) {
            $json = $data;
        } else {
            $json = SerializerBuilder::create()->build()->serialize($data, 'json', $context);
        }
        $this->withBody($json);

        return $this;
    }
public function withJsonBody($data, SerializationContext $context = null)
    {
        if (is_string($data)) {
            $json = $data;
        } else {
            $json = SerializerBuilder::create()->build()->serialize($data, 'json', $context);
        }
        $this->withBody($json);

        return $this;
    }
public function withJsonBody ( $ data , SerializationContext $ context = null ) { if ( is_string ( $ data ) ) { $ json = $ data ; } else { $ json = SerializerBuilder :: create ( ) -> build ( ) -> serialize ( $ data , 'json' , $ context ) ; } $ this -> withBody ( $ json ) ; return $ this ; }
Create json with given data using serialization

@param                           $data
@param SerializationContext|null $context

@return $this
Create json with given data using serialization