src/Norm/Model.php
public function jsonSerialize()
    {
        if (! Norm::options('include')) {
            return $this->toArray();
        }

        $destination = array();
        $source =  $this->toArray();

        $schema = $this->collection->schema();

        foreach ($source as $key => $value) {
            if (isset($schema[$key]) and isset($value)) {
                $destination[$key] = $schema[$key]->toJSON($value);
            } else {
                $destination[$key] = $value;
            }

            $destination[$key] = JsonKit::replaceObject($destination[$key]);
        }

        return $destination;
    }
public function jsonSerialize()
    {
        if (! Norm::options('include')) {
            return $this->toArray();
        }

        $destination = array();
        $source =  $this->toArray();

        $schema = $this->collection->schema();

        foreach ($source as $key => $value) {
            if (isset($schema[$key]) and isset($value)) {
                $destination[$key] = $schema[$key]->toJSON($value);
            } else {
                $destination[$key] = $value;
            }

            $destination[$key] = JsonKit::replaceObject($destination[$key]);
        }

        return $destination;
    }
public function jsonSerialize ( ) { if ( ! Norm :: options ( 'include' ) ) { return $ this -> toArray ( ) ; } $ destination = array ( ) ; $ source = $ this -> toArray ( ) ; $ schema = $ this -> collection -> schema ( ) ; foreach ( $ source as $ key => $ value ) { if ( isset ( $ schema [ $ key ] ) and isset ( $ value ) ) { $ destination [ $ key ] = $ schema [ $ key ] -> toJSON ( $ value ) ; } else { $ destination [ $ key ] = $ value ; } $ destination [ $ key ] = JsonKit :: replaceObject ( $ destination [ $ key ] ) ; } return $ destination ; }
Implement the json serializer normalizing the data structures.

@return array
Implement the json serializer normalizing the data structures .