Get an JSON array with values (along with their timestamps)

@return array of values
778835
public JSONArray jsonifyValues() {
        JSONArray jValues = new JSONArray();
        for (ValueEntry vEntry : values) {
            JSONObject o = new JSONObject();
            o.put("value",vEntry.getValue());
            o.put("timestamp",vEntry.getTimestamp());
            jValues.add(o);
        }
        return jValues;
    }
1144490
public function getJsonValue()
    {
        $parts = DateTimeParser::parseVCardTime($this->getValue());
        $timeStr = '';

        // Hour
        if (!is_null($parts['hour'])) {
            $timeStr .= $parts['hour'];

            if (!is_null($parts['minute'])) {
                $timeStr .= ':';
            }
        } else {
            // We know either minute or second _must_ be set, so we insert a
            // dash for an empty value.
            $timeStr .= '-';
        }

        // Minute
        if (!is_null($parts['minute'])) {
            $timeStr .= $parts['minute'];

            if (!is_null($parts['second'])) {
                $timeStr .= ':';
            }
        } else {
            if (isset($parts['second'])) {
                // Dash for empty minute
                $timeStr .= '-';
            }
        }

        // Second
        if (!is_null($parts['second'])) {
            $timeStr .= $parts['second'];
        }

        // Timezone
        if (!is_null($parts['timezone'])) {
            if ('Z' === $parts['timezone']) {
                $timeStr .= 'Z';
            } else {
                $timeStr .=
                    preg_replace('/([0-9]{2})([0-9]{2})$/', '$1:$2', $parts['timezone']);
            }
        }

        return [$timeStr];
    }
292733
public function getAll()
    {
        $values = json_decode(file_get_contents($this->cacheFile), true);

        if( ! is_array($values)) return [];
        
        foreach ($values as $key => $value) {
            $values[$key] = unserialize($value);
        }
        return $values;
    }
686836
public function getJSONString()
	{
		$json = '{'
				. '"@context":"' .			SocialRecord::JSONLD_CONTEXT . '",'
				. '"@type":"' .				SocialRecord::JSONLD_TYPE . '",'
				. '"type":"' .				$this->type . '",'
				. '"globalID":"' .			$this->globalID . '",'
				. '"platformGID":"' .		$this->platformGID . '",'
				. '"displayName":"' .		$this->displayName . '",'
				. '"profileLocation":"' .	$this->profileLocation . '",'
				. '"personalPublicKey":"' .	PublicKey::exportKey($this->personalPublicKey) . '",'
				. '"accountPublicKey":"' .	PublicKey::exportKey($this->accountPublicKey) . '",'
				. '"salt":"' .	 			$this->salt . '",'
				. '"datetime":"' .	 		$this->datetime . '",'
				. '"active":' . 			$this->active . ','
				. '"keyRevocationList":[';
				
		foreach($this->keyRevocationList as $krc)
		{
			$json .= $krc->getJSONString();
			if($krc !== end($this->keyRevocationList)) $json .= ',';
		}
		
		$json .= ']}';
		
		return $json;
	}
348866
public function jsonSerialize(): array
    {
        return [
            'number' => $this->yearNumber,
            'weeks' => array_map(function(Week $week) {
                return $week->jsonSerialize();
            }, $this->weeks)
        ];
    }
1023468
public function jsonSerialize()
    {
        return array_map(function ($value) {
            if ($value instanceof JsonSerializable) {
                return $value->jsonSerialize();
            } else {
                return $value;
            }
        }, $this->items);
    }
536789
public function jsonSerialize(): array
    {
        return [
            'amount' => $this->getAmount(),
            'cash' => $this->getCashAmount(),
            'tax' => $this->getTaxAmount(),
            'tax_code' => $this->hasTax() ? $this->taxable->taxCode() : null,
            'tax_rate' => $this->hasTax() ? $this->taxable->taxRate() : null,
            'amount_with_tax' => $this->getAmountWithTax(),
            'cash_with_tax' => $this->getCashAmountWithTax(),
            'currency' => $this->getCurrency(),
        ];
    }
318859
public function toJsonArray() {
        $array = $this->_properties;
        foreach ($array as $key => $value) {
            if (in_array($key, $this->fields) && !is_null($value)) {
                $parser = $this->getParser($key);
                $array[$key] = $parser->unparse($value);
            }
            else unset($array[$key]);
        }
        return $array;
    }
1246043
public function toMappedArray()
    {
        $values = $this->toArray();
        $mappedValues = [];
        foreach ($values as $key => $value) {
            $mappedValues[$key] = $this->readMapped($key);
        }

        return $mappedValues;
    }
210914
public function jsonSerialize() {
		$json = array();

		foreach(get_object_vars($this) as $var => $val) {
			if($val instanceof \DateTime)
				$json[$var] = $val->getTimestamp();
			else
				$json[$var] = $val;
		}

		return $json;
	}
1311731
public function jsonSerialize(): array
    {
        $instruction = ['type' => $this->type];

        if ($this->type !== self::TYPE_NOOP) {
            $instruction = array_merge($instruction, [
                'name' => $this->name,
                'catched' => $this->shouldCatchErrors,
            ]);

            if ($this->type !== self::TYPE_GET) {
                $instruction['value'] = $this->value;
            }

            if ($this->resource !== null) {
                $instruction['resource'] = $this->resource;
            }
        }

        return $instruction;
    }
716365
public function toJSON()
    {
        $result = [
            'Status' => $this->Status(),
            'ShouldPass' => $this->ShouldPass(),
            'Checks' => []
        ];
        foreach ($this->details as $detail) {
            $result['Checks'][] = $detail->toMap();
        }
        return json_encode($result);
    }
511488
public function toJsonLd()
    {
        $jsonLd = [];

        $jsonLd['calendarType'] = $this->getType()->toNative();
        // All calendar types allow startDate (and endDate).
        // One timestamp - full day.
        // One timestamp - start hour.
        // One timestamp - start and end hour.
        empty($this->startDate) ?: $jsonLd['startDate'] = $this->getStartDate()->format(DateTime::ATOM);
        empty($this->endDate) ?: $jsonLd['endDate'] = $this->getEndDate()->format(DateTime::ATOM);


        $timestamps = $this->getTimestamps();
        if (!empty($timestamps)) {
            $jsonLd['subEvent'] = array();
            foreach ($timestamps as $timestamp) {
                $jsonLd['subEvent'][] = array(
                  '@type' => 'Event',
                  'startDate' => $timestamp->getStartDate()->format(DateTime::ATOM),
                  'endDate' => $timestamp->getEndDate()->format(DateTime::ATOM),
                );
            }
        }

        // Period.
        // Period with openingtimes.
        // Permanent - "altijd open".
        // Permanent - with openingtimes
        $openingHours = $this->getOpeningHours();
        if (!empty($openingHours)) {
            $jsonLd['openingHours'] = array();
            foreach ($openingHours as $openingHour) {
                $jsonLd['openingHours'][] = $openingHour->serialize();
            }
        }

        return $jsonLd;
    }
978213
public function toJSON()
  {
    $json = json_encode( $this->toArray() );

    return str_replace(
      [
          '"%hoverCallback%"',
          '"%formatter%"',
          '"%dateFormat%"',
      ],
      [
          $this->hoverCallback,
          $this->formatter,
          $this->dateFormat,
      ],
      $json
    );
  }
348323
protected function _readTimestamp()
    {
        $data = array();
        if (empty($data) && file_exists($this->path . static::BUILD_TIME_FILE)) {
            $data = file_get_contents($this->path . static::BUILD_TIME_FILE);
            if ($data) {
                $data = unserialize($data);
            }
        }
        return $data;
    }
1016152
public function jsonSerialize()
    {
        $jsonData = [
            'identity'   => $this->identity,
            'public_key' => $this->publicKey,
            'version'    => $this->version,
            'created_at' => $this->createdAt,
        ];

        if ($this->previousCardId != null) {
            $jsonData['previous_card_id'] = $this->previousCardId;
        }

        return $jsonData;
    }
897916
protected function getValuesJSON() {
		$value = $this->value;
		if($value instanceof SS_List) {
			$values = $value->column($this->idField);
		}
		else if(is_array($value)) {
			$values = array_keys($value);
		}
		else if(is_string($value)) {
			$values = explode(',', $value);
			$values = str_replace('{comma}', ',', $values);
		}

		return $this->formatJSON($this->source->filter(array(
			$this->idField => $values
		)));
	}