Example #1
0
 public function load($resource, $type = null)
 {
     $data = $this->loadFile($resource);
     return Json::parse($data, true);
 }
Example #2
0
 /**
  * Creates a Model instance from data in JSON.
  *
  * @param string $json The input data in JSON.
  * @param boolean $strict If set to TRUE, will throw an exception if the
  *      json contains a property which does not exist in the Model. Default
  *      value is FALSE which means these will be ignored.
  *
  * @return Model
  */
 public static function fromJSON($json, $strict = false)
 {
     $array = Json::parse($json);
     if (is_object($array)) {
         $array = (array) $array;
     }
     return self::fromArray($array, $strict);
 }