Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
Standards
Standards.JSON

Module Standards.JSON

Description

Tools for handling the JSON structured data format. See http://www.json.org/ and RFC 4627.


constant Standards.JSON.ASCII_ONLY
constant Standards.JSON.HUMAN_READABLE
constant Standards.JSON.PIKE_CANONICAL

Description

Bit field flags for use with encode :

Standards.JSON.ASCII_ONLY

Use \uxxxx escapes for all non-ascii characters and DEL (U+007f). The default is to escape only the characters that must be escaped. The flag value is 1.

Characters above U+FFFF are encoded using escaped surrogate pairs, as per RFC 4627.

Standards.JSON.HUMAN_READABLE

Pretty print with indentation to make the result easier on human eyes. The default is to use no extra whitespace at all. The flag value is 2.

Standards.JSON.PIKE_CANONICAL

Make the output canonical, so that the same value always generates the same char-by-char equal string. In practice this means that mapping elements are sorted on their indices. Note that the other flags take precedence, so e.g. the canonical form with HUMAN_READABLE is not the same as the canonical form without it. The flag value is 4.

This canonical form is stable for the encode function, providing floats aren't used (their formatting is currently affected by float size and libc formatting code). In the future there may be a standardized canonical form which quite likely will be different from this one. In that case a separate flag has to be added so this one doesn't change - hence the name PIKE_CANONICAL .


Val.True Standards.JSON.true
Val.False Standards.JSON.false
Val.Null Standards.JSON.null

Description

Compat aliases for the corresponding Val objects. These are used to represent the three JSON literals true, false and null.

Deprecated