« MongoDB\BSON\PackedArray::toPHP
MongoDB\BSON\PackedArray::__toString »

MongoDB\BSON\PackedArray::toRelaxedExtendedJSON

(mongodb >=1.20.0)

MongoDB\BSON\PackedArray::toRelaxedExtendedJSON — Returns the Relaxed Extended JSON representation of the BSON array

説明

final public function MongoDB\BSON\PackedArray::toRelaxedExtendedJSON(): string

Converts the BSON array to its » Relaxed Extended JSON representation. The relaxed format prefers use of JSON type primitives at the expense of type fidelity and is most suited for producing output that can be easily consumed by web APIs and humans.

パラメータ

この関数にはパラメータはありません。

戻り値

Returns a string containing the » Relaxed Extended JSON representation of the BSON array.

例

例1 MongoDB\BSON\PackedArray::toRelaxedExtendedJSON() example

<?php

$array = [
    'foo',
    123,
    4294967295,
    new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1'),
];

$packedArray = MongoDB\BSON\PackedArray::fromPHP($array);
echo $packedArray->toRelaxedExtendedJSON(), "\n";

?>

上の例の出力は以下となります。

[ "foo", 123, 4294967295, { "$oid" : "56315a7c6118fd1b920270b1" } ]

参考

関連キーワード:
MongoDB   PackedArray   representation   Relaxed   toRelaxedExtendedJSON   type   packedArray   toPHP   toString   mongodb   final   relaxed   format   consumed   APIs   humans   containing   ObjectId   fromPHP   fromJSON   Construct   instance   toCanonicalExtendedJSON   Canonical   Specification
関連する関数・ページ:
mongodb-bson-packedarray.tostring   mongodb-bson-packedarray.tocanonicalextendedjson   mongodb-bson-packedarray.tophp   class.mongodb-bson-packedarray   mongodb-bson-packedarray.construct   mongodb-bson-packedarray.fromjson

他のマニュアルの関連ページ