Pike v8.1 release 6

Method Stdio.Buffer()->read_json()


Method read_json

mixed read_json(int|void require_whitespace_separator)

Description

Read a single JSON expression from the buffer and return it.

If require_whitespace_separator is true there must be a whitespace after each json value (as an example, newline or space).

The JSON is assumed to be utf-8 encoded.

Returns

UNDEFINED if no data is available to read. The read value otherwise.

Note

Unless whitespaces are required this function only really work correctly with objects, arrays and strings.

There is really no way to see where one value starts and the other ends for most other cases