Allow Input::json() to return array instead of object

This commit is contained in:
Aaron Kuzemchak 2012-09-05 16:07:20 -04:00
parent 2b1d8e6c83
commit 69ebe6d56a
1 changed files with 3 additions and 2 deletions

View File

@ -102,13 +102,14 @@ public static function query($key = null, $default = null)
/** /**
* Get the JSON payload for the request. * Get the JSON payload for the request.
* *
* @param bool $as_array
* @return object * @return object
*/ */
public static function json() public static function json($as_array = false)
{ {
if ( ! is_null(static::$json)) return static::$json; if ( ! is_null(static::$json)) return static::$json;
return static::$json = json_decode(Request::foundation()->getContent()); return static::$json = json_decode(Request::foundation()->getContent(), $as_array);
} }
/** /**