You are here

class wsdata_simple_json_processor in Web Service Data 7

Hierarchy

Expanded class hierarchy of wsdata_simple_json_processor

File

./wsdata_simple_json.wsdata.processor.inc, line 3

View source
class wsdata_simple_json_processor extends WsData {

  // Parse the web service response string, and returns a structured data array
  public function parse($data) {
    if (!isset($data) || empty($data)) {
      return;
    }

    // Remove UTF-8 BOM if present, json_decode() does not like it.
    if (substr($data, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
      $data = substr($data, 3);
    }
    $data = trim($data);
    return json_decode($data, TRUE);
  }
  function accepts() {
    return array(
      'json',
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WsData::$data public property
WsData::$error protected property
WsData::$languages protected property
WsData::addData public function Add data to an empty object or replace all existing data
WsData::getData public function Retrieve the value for the given data key. 1
WsData::getError public function
WsData::__construct public function
wsdata_simple_json_processor::accepts function Overrides WsData::accepts
wsdata_simple_json_processor::parse public function Overrides WsData::parse 1