Skip to content

1.2 Class GSObject PHP

Levi edited this page Jun 11, 2026 · 2 revisions

Description

Used for passing parameters, for example when issuing requests or receiving response data. The object holds [key, value] pairs. The key represents a parameter name (type String) and the value may be one of the following types:

  • string

  • Boolean

  • int

  • long

  • double

  • GSObject

  • [GSArray][(https://github.com/SAP/gigya-php-sdk/wiki/1.1-Class-GSArray-PHP)

Constructor Summary

Constructor Description
GSObject() Construct a GSObject from a JSON string. Throws an Exception if unable to parse the JSON string.
GSObject(string $json)

Method Summary

Return Method Description
void clear() Removes all of the entries from this object.
integer getInt(string $key [, integer $defaultValue]) Type specific methods for retrieving value by key. If the key is not found, and there is no default value, the method throws GSKeyNotFoundException.
double getDouble(string $key [, double $defaultValue])
long getLong(string $key [, long $defaultValue])
bool getBool(string $key [, bool $defaultValue])
string getString(string $key [, string $defaultValue])
GSObject getObject(string $key)
GSArray getArray(string $key)
array getKeys() Returns the keys, numeric and string, from the array.
void parseQueryString(string $qs) Parses parameters from a query string into this object.
void parseURL(string $url) Parses parameters from a URL string into this object.
Boolean containsKey(string $key) Returns true if this object contains a mapping for the specified key.
void put(string $key, mixed $value) Adds a [key, value] pair to this object.
void remove(string $key) Removes a [key, value] pair from this object.
string toJsonString() Returns the object's content as a JSON string.
string toString() Returns the object's content as a JSON string.

Clone this wiki locally