src/Core/Http/Serialization/JsonObjectSerializer.php
private function convertObject($object, $limitToOne)
        {
            if ($object instanceof \stdClass) {
                $result = array();
                $vars = get_object_vars($object);
                if (empty($vars)) {
                    return null;
                }
                foreach ($vars as $key=>$value) {
                    $className = self::decorateIntuitEntityToPhpClassName($key);
                    if (!class_exists($className)) {
                        continue;
                    }
                    $entity = DomainEntityBuilder::create($className, $value);

                    if ($limitToOne) {
                        return $entity;
                    }
                    $result[] = $entity;
                }
                if (empty($result)) {
                    // Reutrn original parsed object and don't try to convert types
                    return $limitToOne ? $object : array($object);
                } else {
                    return $result;
                }
            }

            return $object;
        }
private function convertObject($object, $limitToOne)
        {
            if ($object instanceof \stdClass) {
                $result = array();
                $vars = get_object_vars($object);
                if (empty($vars)) {
                    return null;
                }
                foreach ($vars as $key=>$value) {
                    $className = self::decorateIntuitEntityToPhpClassName($key);
                    if (!class_exists($className)) {
                        continue;
                    }
                    $entity = DomainEntityBuilder::create($className, $value);

                    if ($limitToOne) {
                        return $entity;
                    }
                    $result[] = $entity;
                }
                if (empty($result)) {
                    // Reutrn original parsed object and don't try to convert types
                    return $limitToOne ? $object : array($object);
                } else {
                    return $result;
                }
            }

            return $object;
        }
Converts stdClass objects into object with specified type
It tries to learn type from JSON responce

@param object $object
@param boolean $limitToOne
@return mixed (stdClass or domain model entity)