Lizmap Web Client 3.11.0

JsonStreamWriter
in package

Write data as JSON to a stream, copying the JsonColumn values directly from their temporary stream, without decoding them.

The data, except the columns, is encoded with json_encode: each column is replaced by a unique placeholder string, then the encoded JSON is split on the placeholders and the columns are written between the parts.

Table of Contents

Constants

JSON_FLAGS  : mixed = 0
Flags used to encode the JSON, the same as jResponseJson

Methods

encode()  : string
Encode the data as a JSON string.
write()  : void
Write the data as JSON to the output stream.

Constants

JSON_FLAGS

Flags used to encode the JSON, the same as jResponseJson

public mixed JSON_FLAGS = 0

Methods

encode()

Encode the data as a JSON string.

public static encode(mixed $data) : string

Unlike write(), the whole JSON is loaded in memory: use it only for small data or for tests.

Parameters
$data : mixed

the data, which can contain JsonColumn objects

Return values
string —

the JSON

write()

Write the data as JSON to the output stream.

public static write(mixed $data, resource $output) : void

The JsonColumn objects found in the data are written as JSON arrays, by copying their content, so their values are never loaded in memory.

Parameters
$data : mixed

the data, which can contain JsonColumn objects at any depth of nested arrays

$output : resource

the output stream

On this page

Search results