Determine if the http response looks like a JSON object

@return \StdClass the decoded response, or null if wasn't a json object
488575
public function getJsonResponse()
    {
        $json = json_decode($this->httpResponse);
        if (is_null($json) && json_last_error() != JSON_ERROR_NONE) {
            return null; // decode error
        } else {
            return is_object($json) ? $json : null;
        }
    }
1348847
public function getJsonObject()
    {
        // array_filter() ensures that empty values are filtered out
        // array_values() ensures encoding to array rather than object
        $this->sslRoutingRestrictedUrls     = array_values(array_filter($this->sslRoutingRestrictedUrls));
        $this->maintenanceModeAuthorizedIps = array_values(array_filter($this->maintenanceModeAuthorizedIps));

        return json_encode(get_object_vars($this));
    }
1147553
function jsonSerialize()
    {
        $data = [
            'text' => $this->text
        ];

        if ($this->replyMarkup) {
            $data['reply_markup'] = $this->replyMarkup;
        }

        return $data;
    }
858544
public static function isJSON($json)
    {
        if ($json === '[]' || $json === '{}') {
            return true;
        } else if (is_array($json)) {
            return false;
        }

        return static::decode($json) != null;
    }
362849
public function jsonSerialize() {
    $valid = (!isset($this->color) ||
        $this->validateColor($this->color));
    if (!$valid) {
      return NULL;
    }
    return parent::jsonSerialize();
  }
498772
public static function _decode($data)
    {
        // The json decoded response from Avos will make JSONObjects into stdClass
        //   objects.  We'll change it to an associative array here.
        if ($data instanceof \stdClass)
        {
            $tmp = (array) $data;
            if (!empty($tmp))
            {
                return self::_decode(get_object_vars($data));
            }
        }

        if (!$data && !is_array($data))
        {
            return null;
        }

        if (is_array($data))
        {
            $typeString = (isset($data['__type']) ? $data['__type'] : null);

            if ($typeString === 'Date')
            {
                return new \DateTime($data['iso']);
            }

            if ($typeString === 'Bytes')
            {
                return base64_decode($data['base64']);
            }

            if ($typeString === 'Pointer')
            {
                return AVObject::create($data['className'], $data['objectId']);
            }

            if ($typeString === 'File')
            {
                return AVFile::_createFromServer($data['name'], $data['url']);
            }

            if ($typeString === 'GeoPoint')
            {
                return new AVGeoPoint($data['latitude'], $data['longitude']);
            }

            if ($typeString === 'Object')
            {
                $output = AVObject::create($data['className']);
                $output->_mergeAfterFetch($data);

                return $output;
            }

            if ($typeString === 'Relation')
            {
                return $data;
            }

            $newDict = array();
            foreach ($data as $key => $value)
            {
                $newDict[$key] = static::_decode($value);
            }

            return $newDict;

        }

        return $data;
    }
980813
public function jsonSerialize() {
        $ret = new \stdClass();

        $ret->deleteInsteadOfAppend = $this->deleteInsteadOfAppend;

        if (count($this->subscriberIds) > 0) {
            $ret->subscrberIds = $this->subscriberIds;
        }

        if (count($this->emails) > 0) {
            $ret->emails = $this->emails;
        }

        return $ret;
    }
1335772
public function isJson() {
        if (!$this->endsWith('}') && !$this->endsWith(']')) {
            return false;
        }

        return !is_null(json_decode($this->str));
    }
434277
public function jsonSerialize()
    {
        $ret = new stdClass();
        $ret->code = $this->errorCode;
        $ret->message = $this->getUserMessage();

        return $ret;
    }
1285891
public function jsonSerialize() {
    $valid = !isset($this->preferredStartingPosition) ||
      $this->validatePreferredStartingPosition($this->preferredStartingPosition);
    if (!$valid) {
      return NULL;
    }
    return parent::jsonSerialize();
  }
307597
public function decodeFromJson()
    {
        $parsed = json_decode($this->body, true);

        if (is_null($parsed)) {
            throw new UnexpectedResponseFormatException($this);
        }

        return $parsed;
    }
553871
public function getJson()
    {
        $response = [
            'status' => $this->status,
        ];

        switch ($this->status) {
            case self::STATUS_SUCCESS:
            case self::STATUS_FAIL:
                $response = array_merge(
                    $response,
                    [
                        'data' => $this->data,
                    ]
                );
                break;
            case self::STATUS_ERROR;
                $code     = $this->code ? ['code' => $this->code] : [];
                $data     = $this->data ? ['data' => $this->data] : [];
                $response = array_merge(
                    $response,
                    [
                        'message' => $this->message,
                    ],
                    $code,
                    $data
                );
                break;
            default:
                // because of the check in setStatus, this should never occur
                $response = [
                    'status'  => self::STATUS_ERROR,
                    'code'    => 500,
                    'message' => 'JSend response was built illegally',
                    'data'    => [
                        'original-data' => [
                            'status'  => $this->status,
                            'code'    => $this->code,
                            'message' => $this->message,
                            'data'    => $this->data,
                        ],
                    ],
                ];
                break;
        }

        return json_encode($response);
    }
1102889
public function seeResponseIsJson()
    {
        $responseContent = $this->connectionModule->_getResponseContent();
        \PHPUnit\Framework\Assert::assertNotEquals('', $responseContent, 'response is empty');
        json_decode($responseContent);
        $errorCode = json_last_error();
        $errorMessage = json_last_error_msg();
        \PHPUnit\Framework\Assert::assertEquals(
            JSON_ERROR_NONE,
            $errorCode,
            sprintf(
                "Invalid json: %s. System message: %s.",
                $responseContent,
                $errorMessage
            )
        );
    }
218391
public function isDataUrl()
    {
        $data = $this->decodeDataUrl($this->data);

        return is_null($data) ? false : true;
    }
345282
public function jsonSerialize(){
		if($this->asValue() instanceof \DateTime){
			if($this->hasOption('format')){
				return $this->asValue()->format($this->options()->format);
			}else{
				if($this->hasOption('jsonnull') && $this->options()->jsonnull){
					return null;
				}
			}
		}

		if($this->hasOption('jsonnull') && $this->options()->jsonnull){
			return null;
		}
	}
68842
public function getPayloadJSON()
    {
        $data = is_string($this->data) ? mb_convert_encoding($this->data, 'UTF-8') : $this->data;
        return json_encode($data);
    }
1142630
function jsonSerialize(): \stdClass {
    return (object) [
      'testName' => $this->getTestName(),
      'records' => array_map(function(Record $item) {
        return $item->jsonSerialize();
      }, $this->getRecords()->getArrayCopy())
    ];
  }