src/Http/Traits/HasJsonInput.php
/**
	 * Parses the request content as JSON and returns the specified key. If the key does not exist, it returns the
	 * default value provided (or null). If the key parmater is ommited, the entire decoded array is provided.
	 *
	 * @param mixed $default Return value if key is not found.
	 * @return array|mixed|null
	 */
Parses the request content as JSON and returns the specified key. If the key does not exist, it returns the
default value provided (or null). If the key parmater is ommited, the entire decoded array is provided.

@param mixed $default Return value if key is not found.
@return array|mixed|null
Parses the request content as JSON and returns the specified key . If the key does not exist it returns the default value provided ( or null ) . If the key parmater is ommited the entire decoded array is provided . @param mixed $default Return value if key is not found . @return array|mixed|null
public function json($key = null, $default = null) {
		if (!isset($this->json)) {
			$decoded = @json_decode($this->getContent(), true);
			$this->json = new ParameterBag((array) $decoded);
			$this->jsonStoreError();
		}
		if (is_null($key)) {
			return $this->json->all();
		}
		return $this->json->get($key, $default, true);
	}
public function json ( $ key = null , $ default = null ) { if ( ! isset ( $ this -> json ) ) { $ decoded = @ json_decode ( $ this -> getContent ( ) , true ) ; $ this -> json = new ParameterBag ( ( array ) $ decoded ) ; $ this -> jsonStoreError ( ) ; } if ( is_null ( $ key ) ) { return $ this -> json -> all ( ) ; } return $ this -> json -> get ( $ key , $ default , true ) ; }
Parses the request content as JSON and returns the specified key.
Parses the request content as JSON and returns the specified key .
// Decode the content with errors suppressed // Create a parameter bag with the content // Store errors // Return the entire array