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

Twitter updates

  • New post: With ProcessWire 3.0.130, this week we’ll take a detailed look at a few useful new API additions made in the last few weeks, along with examples of each—More
    12 April 2019
  • New post: This week ProcessWire ProMailer has been released, plus we’ve got a nice upgrade in our community support forum, and more— More
    15 March 2019
  • New post: This week we look at the latest version of ProcessWire, 3.0.127 with nearly 30 new commits resolving dozens of older issue reports and a couple useful new features— More
    1 March 2019

Latest news

  • ProcessWire Weekly #257
    In the 257th issue of ProcessWire Weekly we'll walk you through the new features in ProcessWire 3.0.130, introduce two new third party modules, and showcase the elegant new website of the QFMA. Read on!
    Weekly.pw / 13 April 2019
  • ProcessWire 3.0.130 core updates
    This week we’ll take a detailed look at a few useful new API additions made in the last few weeks, along with examples of each.
    Blog / 12 April 2019
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer