Get the full data object contents.  Either an array if returnSingleResult is false or a single object if it is true.
@method toJSON
@return {Object|Object[]} containing the full contents of either the collection or model.
352950
function() {
      var privateCollection = this.privateCollection;
      if (!this.parentBehavior.returnSingleResult) {
        return privateCollection.toJSON();
      }

      if (privateCollection.length === 0) {
        return undefined;
      } else if (privateCollection.length === 1) {
        var singleResultModel = privateCollection.at(0);
        return singleResultModel.toJSON();
      } else {
        throw new Error('Multiple results found, but single result expected: ' + JSON.stringify(privateCollection.toJSON()));
      }
    }
552927
public function jsonSerialize() {
        $data = [];
        if ($this->errors) $data['errors'] = $this->errors;
        else {
            $data['data'] = $this->data;
            if ((!$this->links || !$this->getLink('self')) && $this->data) {
                if ($this->data instanceof ResourceInterface) {
                    $this->addLink($this->getFactory()->newLink([ 'name' => 'self', 'href' => $this->baseUrl.$this->data->getSelfLinkPath() ]));
                } elseif ($this->data instanceof ResourceCollectionInterface && count($this->data)) {
                    $this->addLink($this->getFactory()->newLink([ 'name' => 'self', 'href' => $this->baseUrl.$this->data[0]->getCollectionLinkPath() ]));
                }
            }

            if (count($this->included)) $data["included"] = $this->included;
        }

        if ($this->links) $data['links'] = $this->links;
        if ($this->meta) $data['meta'] = $this->meta;

        $data['jsonapi'] = $this->jsonapi;

        return $data;
    }
1117161
public function getJson()
    {
        global $CFG, $PDOX;

        $row = $PDOX->rowDie("SELECT json FROM {$CFG->dbprefix}{$this->TABLE_NAME}
                WHERE $this->PRIMARY_KEY = :PK",
            array(":PK" => $this->id));
        if ( $row === false ) return false;
        $json = $row['json'];
        if ( $json === null ) return false;
        return $json;
    }
1185196
public function toJson() {
		$array = array("types"=>array());
		foreach ($this->types as $type) {
			$array["types"][] = $type->toJson();
		}
		if ($this->warningMessage) {
			$array["warning"] = $this->warningMessage;
		}
		return $array;
	}
521107
public function getData()
    {
        if (null == $this->_response) {
            $response = $this->_responseString;

            try {
                if ($this->getJsonBigintConversion()) {
                    $response = JSON::parse($response, true, 512, JSON_BIGINT_AS_STRING);
                } else {
                    $response = JSON::parse($response);
                }
            } catch (JSONParseException $e) {
                // leave response as is if parse fails
            }

            if (empty($response)) {
                $response = [];
            }

            if (\is_string($response)) {
                $response = ['message' => $response];
            }

            $this->_response = $response;
            $this->_responseString = '';
        }

        return $this->_response;
    }
381130
function() {
      var result = Object.create(null);

      result.initialized = this.initialized;
      result.rule = this.rule.toJSON();
      result.dtstart = this.dtstart.toJSON();
      result.by_data = this.by_data;
      result.days = this.days;
      result.last = this.last.toJSON();
      result.by_indices = this.by_indices;
      result.occurrence_number = this.occurrence_number;

      return result;
    }
1023468
public function jsonSerialize()
    {
        return array_map(function ($value) {
            if ($value instanceof JsonSerializable) {
                return $value->jsonSerialize();
            } else {
                return $value;
            }
        }, $this->items);
    }
480814
protected function toJson()
    {
        $serializedActionResults = [];

        foreach ($this->results as $action => $result) {
            $serializedActionResults[$action] = serialize($result);
        }

        $responseData = [
            'requestId' => $this->requestId,
            'actionResults' => $serializedActionResults
        ];

        return json_encode($responseData);
    }
13291
public function toDatatablesJSONString() {
		$return_object_array = [ ];
		$fields = $this->getFields ();
		foreach ( $fields as $field ) {
			$value = call_user_func ( array (
					$this,
					'get' . $field 
			) );
			if ($value instanceof \DateTime) {
				$value = $value->format ( 'Y-m-d' );
			}
			array_push ( $return_object_array, array (
					$field => $value 
			) );
		}
		return json_encode ( $this );
	}
829317
public function toJson() {
		$result = array();
		$value = $this->getValue();

		if ($value instanceof MoufInstanceDescriptor) {
			$serializableValue = $value->getIdentifierName();
			//$result['type'] = 'object';
		} elseif (is_array($value)) {
			// We cannot match a PHP array to a JSON array!
			// The keys in a PHP array are ordered. The key in a JSON array are not ordered!
			// Therefore, we will be sending the arrays as JSON arrays of key/values to preserve order.
			$serializableValue = self::arrayToJson($value);
			
			//$result['type'] = 'scalar';
			// Let's find the type:
			/*foreach ($value as $val) {
				if ($val instanceof MoufInstanceDescriptor) {
					//$result['type'] = 'object';
					break;
				}
			}*/
			
		} else {
			$serializableValue = $value;
			//$result['type'] = 'scalar';
		}
		
		try {
			$type = $this->propertyDescriptor->getTypes()->getCompatibleTypeForInstance($value);
		} catch (\ReflectionException $e) {
			// If an error occurs here, let's silently continue with an error message added.
			$result['warning'] = $e->getMessage();
			$type = null;
		}
		/*if ($type == null) {
			throw new MoufException("Error for property ".$this->propertyDescriptor->getName()." for instance ".$this->instanceDescriptor->getName().".");
		}*/
		if ($type == null) {
			$result['type'] = null;
		} else {
			$result['type'] = $type->toJson();
		}
		$result['value'] = $serializableValue;
		$result['isset'] = $this->isValueSet();
		$result['origin'] = $this->getOrigin();
		$result['metadata'] = $this->getMetaData();
		return $result;
	}
981361
public function toJson()
    {
        array_walk_recursive($this->params, function (&$value) {
            $value = (string) $value;
        });
        return json_encode($this->params);
    }
366135
public function getJsonValue()
    {
        // Structured text values should always be returned as a single
        // array-item. Multi-value text should be returned as multiple items in
        // the top-array.
        if (in_array($this->name, $this->structuredValues)) {
            return [$this->getParts()];
        }

        return $this->getParts();
    }
505740
public function getContent()
    {
        //Convert non scalar responses
        if ($this->content && !is_scalar($this->content) && !$this->json) {
            $this->toJson();
        }

        if (($this->json || $this->request->wantsJson()) && !is_scalar($this->content)) {
            if ($this->content instanceof Collection) {
                return json_encode($this->content->toArray());
            } else {
                return json_encode((array) $this->content);
            }
        } else {
            return $this->content;
        }
    }
280118
public function toJSON(){
        $outcomeValue = null;
        if($this->defaultValue != ''){
            $outcomeValue = Array($this->defaultValue);
        }else if($this->getAttributeValue('baseType') == 'integer' || $this->getAttributeValue('baseType') == 'float'){
            $outcomeValue = Array(0);
        }else{
            $outcomeValue = null;
        }

        $returnValue = taoQTI_models_classes_Matching_VariableFactory::createJSONVariableFromQTIData(
                        $this->getIdentifier()
                        , $this->getAttributeValue('cardinality')
                        , $this->getAttributeValue('baseType')
                        , $outcomeValue
        );

        return $returnValue;
    }
1196697
public function toJson() {
    	$result = array();
    	$result['name'] = $this->getName();
    	$result['hasDefault'] = $this->isDefaultValueAvailable();
    	try {
    		if ($result['hasDefault']) {
    			// In some cases, the call to getDefaultValue can log NOTICES
    			// in particular if an undefined constant is used as default value.
    			ob_start();
    			if ($this->isDefaultValueConstant() && !defined($this->getDefaultValueConstantName())) {
    			    throw new \Exception('Constant "'.$this->getDefaultValueConstantName().'" does not exist.');
                }
    			$result['default'] = $this->getDefaultValue();
    			$possibleError = ob_get_clean();
    			if ($possibleError) {
    				throw new \Exception($possibleError);
    			}
    		}
    		$result['isArray'] = $this->isArray();
    		
    		// Let's export only the type if we are in a constructor... in order to save time.
    		if ($this->getDeclaringFunction()->isConstructor()) {
    			// TODO: is there a need to instanciate a  MoufPropertyDescriptor?
    			$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
    
    			$result['comment'] = $moufPropertyDescriptor->getDocCommentWithoutAnnotations();
    
    	    	$types = $moufPropertyDescriptor->getTypes();
	    		$result['types'] = $types->toJson();
	    	 
	    		if ($types->getWarningMessage()) {
	    			$result['classinerror'] = $types->getWarningMessage();
	    		}
    			
    			/*if ($moufPropertyDescriptor->isAssociativeArray()) {
    				$result['keytype'] = $moufPropertyDescriptor->getKeyType();
    			}
    			if ($moufPropertyDescriptor->isArray()) {
    				$result['subtype'] = $moufPropertyDescriptor->getSubType();
    			}*/
    		}
    	} catch (\Exception $e) {
    		$result['classinerror'] = $e->getMessage();
    	}
    
    	return $result;
    }
512668
public function jsonSerialize()
		{
			$data               = (object) [];
			$data->type         = 'folder';
			$data->name         = $this->name;
			$data->route        = $this->route;
			$data->parents      = $this->parents;
			$data->folders      = $this->folders;
			$data->controllers  = $this->controllers;
			return $data;
		}
1324983
public function toJson()
    {
        $json = null;
        if (!empty($this->toArray())) {
            $json = json_encode($this->toArray());
        }

        return $json;
    }