Serializes the object to a value that can be serialized natively by json_encode().
@return array Associative .
@link http://php.net/manual/en/jsonserializable.jsonserialize.php
330709
public function jsonSerialize(): array
    {

        $returnArray = parent::jsonSerialize();
        $returnArray['Email'] = $this->email;
        $returnArray['Numbers'] = $this->numbers;
        if (count($this->contacts) > 0) {
            $returnArray['Contacts'] = [];
            foreach ($this->contacts as $contact) {
                $returnArray['Contacts'][] = $contact->getID();
            }
        }
        if (count($this->groups) > 0) {
            $returnArray['Groups'] = [];
            foreach ($this->groups as $group) {
                $returnArray['Groups'][] = $group->getID();
            }
        }
        return $returnArray;
    }
28449
public function jsonSerialize(){
		if(is_object($this->mixValue)){
			$mixJSON = json_encode($this->mixValue);
			if((!is_null($this->mixValue) && $mixJSON!='[]') || ($this->hasOption('jsonnull') && $this->options()->jsonnull)){
				return $this->mixValue;
			}
		}

		return null;
	}
164177
public function jsonSerialize()
    {
        $parameters = [];

        if ($this->accessToken) {
            $parameters['access_token'] = $this->accessToken;
        }

        if ($this->userId) {
            $parameters['user_id'] = $this->userId;
        }

        if ($this->entityId) {
            $parameters['entity_id'] = $this->entityId;
        }

        if ($this->expires) {
            $parameters['expires'] = $this->expires;
        }

        return $parameters;
    }
312532
public function jsonSerialize(): array
    {
        $parentArray = parent::jsonSerialize();
        $parentArray['Created'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s.").
            substr($this->updated->format('u'), 0, 3) : null;
        $parentArray['Updated'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s.").
            substr($this->updated->format('u'), 0, 3) : null;
        $parentArray['ID'] = $this->groupID;
        return $parentArray;
    }
615562
public function jsonSerialize()
    {
        $components = [];
        $properties = [];

        foreach ($this->children as $childGroup) {
            foreach ($childGroup as $child) {
                if ($child instanceof self) {
                    $components[] = $child->jsonSerialize();
                } else {
                    $properties[] = $child->jsonSerialize();
                }
            }
        }

        return [
            strtolower($this->name),
            $properties,
            $components,
        ];
    }
1110607
public function jsonSerialize()
    {
        $data = [
            'title' => $this->title,
            'address' => $this->address
        ];


        $data = array_merge($data, $this->buildJsonAttributes([
            'reply_markup' => $this->replyMarkup
        ]));

        return $data;
    }
1317293
public function jsonSerialize()
    {
        return array_filter(
            [
                'email' => $this->getEmail(),
                'first_name' => $this->getFirstName(),
                'last_name' => $this->getLastName()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
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;
	}
399771
public function serialize() {
		$assoc = $this->isAssociative === null ? 'n' : ( $this->isAssociative ? 't' : 'f' );

		$data = [
			'data' => $this->getArrayCopy(),
			'index' => $this->indexOffset,
			'typePointers' => $this->typePointers,
			'assoc' => $assoc
		];

		return serialize( $data );
	}
1324639
public function jsonSerialize() {
    // Define empty attribute values.
    // @see http://php.net/manual/en/language.types.boolean.php#language.types.boolean.casting
    $present = function($value) {
      if ($value === NULL) {
        return FALSE;
      }
      if (is_string($value)) {
        return $value !== '';
      }
      if (is_array($value)) {
        return (bool) $value;
      }
      return TRUE;
    };

    // Protected attributes are not outputted via parent::__toString().
    $out = get_object_vars($this);

    // Required attributes.
    $names = array_diff(array_keys($out), $this->optional());
    foreach ($names as $name) {
      if (!isset($out[$name]) || !$present($out[$name])) {
        $this->triggerError("Missing required attribute ${name}.");
        return NULL;
      }
    }

    // Unset optional attributes.
    $names = array_intersect($this->optional(), array_keys($out));
    foreach ($names as $name) {
      if (!$present($out[$name])) {
        unset($out[$name]);
      }
    }

    // Return empty object, not array.
    if (empty($out)) {
      return new \stdClass();
    }

    return $out;
  }
610213
public function jsonSerialize()
    {
        return array(
            self::ID    => $this->getOriginalName(),
            self::LABEL => $this->getOriginalName(),
            self::NAME  => $this->getOriginalName(),
        );
    }
895704
public function jsonSerialize()
    {
        $jsonArray = [
            "error" => [
                "message" => $this->getMessage(),
                "code" => $this->getCode()
            ]
        ];

        if (isset($this->details)) {
            $jsonArray["error"]["details"] = $this->details;
        }

        if (isset($this->innerError)) {
            $jsonArray["error"]["innererror"] = [
                "code" => $this->innerError
            ];
        }

        return $jsonArray;
    }
1267346
public function jsonSerialize()
    {
        return [
            'id' => $this->id,
            'size' => $this->size,
            'link' => $this->link,
            'title' => $this->title,
            'caption' => $this->caption,
            'description' => $this->description,
            'type' => $this->type,
            'mimeType' => $this->mime_type,
            'meta' => $this->meta,
            'width' => $this->width,
            'height' => $this->height,
        ];
    }
1233098
public function serialize()
    {
        $serialized = new \stdClass();
        $serialized->username = $this->_login;
        $serialized->commonname = trim($this->_firstname . ' ' . $this->_lastname);

        return json_encode($serialized);
    }
60911
public function serialize()
    {
        $result = array();
        foreach ($this->getKeys() as $k => $v) {
            $result[] = $k . ': ' . $v;
        }
        foreach ($this->getVariables() as $k => $v) {
            if (is_array($v)) {
                foreach ($v as $singleValue) {
                    $result[] = $this->serializeVariable($k, $singleValue);
                }
            } else {
                $result[] = $this->serializeVariable($k, $v);
            }
        }
        $mStr = $this->finishMessage(implode(self::EOL, $result));
        return $mStr;
    }
781817
public function jsonSerialize(): array
    {
        $outObj        = array();
        $outObj['url'] = $this->url;
        if ($this->anchor !== null) {
            $outObj['anchor'] = $this->anchor;
        }
        return $outObj;
    }
83716
function jsonSerialize()
	{
		return array_map(function ($value) {
			if($value instanceof JsonSerializable)
			{
				return $value->jsonSerialize();
			}
			else if($value instanceof Jsonable)
			{
				return Json::parse($this->toJson(), true);
			}
			else if($value instanceof Arrayable)
			{
				return $value->toArray();
			}
			else
			{
				return $value;
			}
		}, $this->items);
	}