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.137

Twitter updates

  • ProcessWire 3.0.146 on the dev branch contains about 22 commits with a combination of useful upgrades and issue report resolutions, more details in this forum post: More
    22 November 2019
  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019
  • ProcessWire 3.0.144 core updates: Upgraded overrides section in the field editor, a new Inputfields JS API, and more— More
    1 November 2019

Latest news

  • ProcessWire Weekly #291
    In the 291st issue of ProcessWire Weekly we're going to take a closer look at the latest core updates, check out a brand new third party module called ProcessHelpVideos, and introduce a new site of the week. Read on!
    Weekly.pw / 8 December 2019
  • New User Activity module
    Blog / 29 November 2019
  • Subscribe to weekly ProcessWire news

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer