You are here

public function wsdata_simple_json_processor::parse in Web Service Data 7

Overrides WsData::parse

1 call to wsdata_simple_json_processor::parse()
wsbeans_default_json_form::parse in modules/wsbeans/wsbeans_default_json_form.processor.inc
1 method overrides wsdata_simple_json_processor::parse()
wsbeans_default_json_form::parse in modules/wsbeans/wsbeans_default_json_form.processor.inc

File

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

Class

wsdata_simple_json_processor

Code

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);
}