class Illuminate / Http / JsonResponse
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

JsonResponse

Extends

    Symfony\...\JsonResponse

Uses

Methods

public

__construct ( $data , $status , $headers , $options , $json ) : void

Create a new JSON response instance.

Parameters

  • $data mixed
  • $status int
  • $headers array
  • $options int
  • $json bool
public static

fromJsonString ( string $data , int $status , array $headers ) : static

{@inheritdoc}

public

withCallback ( $callback ) : $this

Sets the JSONP callback.

Parameters

  • $callback string|null
public

getData ( $assoc , $depth ) : mixed

Get the json_decoded data from the response.

Parameters

  • $assoc bool
  • $depth int
public

setData ( $data ) : static

{@inheritdoc}

protected

hasValidJson ( $jsonError ) : bool

Determine if an error occurred during JSON encoding.

Parameters

  • $jsonError int
public

setEncodingOptions ( $options ) : static

{@inheritdoc}

public

hasEncodingOption ( $option ) : bool

Determine if a JSON encoding option is set.

Parameters

  • $option int