WireHttp::getJSON() method

Send to a URL that responds with JSON (using GET request) and return the resulting array or object.

Usage

// basic usage
$bool = $http->getJSON(string $url);

// usage with all arguments
$bool = $http->getJSON(string $url, bool $assoc = true, mixed $data = [], array $options = []);

Arguments

NameType(s)Description
urlstring

URL to send request to (including http:// or https://)

assoc (optional)bool

Default is to return an array (specified by TRUE). If you want an object instead, specify FALSE.

data (optional)mixed

Array of data to send (if not already set before) or raw data to send

options (optional)array

Optional options to modify default behavior, see the send() method for details.

Return value

bool array object

False on failure or an array or object on success.

See Also


$http methods and properties

API reference based on ProcessWire core version 3.0.161

Twitter updates

  • ProcessWire 3.0.163 resolves more than a dozen issue reports and adds new hooks and configurable module install options, among numerous other updates. In addition, a major update to ProCache (v4.0) has been released— More
    24 July 2020
  • Weekly update for 17 July 2020 and a look at new features coming in next week's version of ProCache— More
    17 July 2020
  • ProcessWire 3.0.162 continues improvements to selector operators, fixes various minor issues, adds new API convenience methods, improves documentation, optimizes and refactors various portions of code and DB queries, and more— More
    10 July 2020

Latest news

  • ProcessWire Weekly #324
    In the 324th issue of ProcessWire Weekly we'll cover ProcessWire 3.0.163, ProCache v4, two brand new third party modules, and more. Read on!
    Weekly.pw / 25 July 2020
  • Powerful new text-searching abilities in 3.0.160
    In ProcessWire 3.0.160 we’ve got some major upgrades and additions to our text-search abilities. This brings a whole new level of power to $pages->find() and similar API calls, especially when it comes to search engine type queries.
    Blog / 19 June 2020
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull