Document s% and s# for json_pack, s% for json_unpack

This commit is contained in:
Petri Lehtinen 2013-09-30 08:46:35 +03:00
parent e2dcf94598
commit 7876125a22
2 changed files with 18 additions and 9 deletions

View File

@ -1113,6 +1113,11 @@ arguments.
.. versionadded:: 2.5
``s%`` (string) [const char \*, size_t]
Like ``s#`` but the length argument is of type :type:`size_t`.
.. versionadded:: 2.6
``+`` [const char \*]
Like ``s``, but concatenate to the previous string. Only valid
after ``s``, ``s#``, ``+`` or ``+#``.
@ -1125,6 +1130,11 @@ arguments.
.. versionadded:: 2.5
``+%`` (string) [const char \*, size_t]
Like ``+#`` but the length argument is of type :type:`size_t`.
.. versionadded:: 2.6
``n`` (null)
Output a JSON null value. No argument is consumed.
@ -1239,6 +1249,12 @@ type whose address should be passed.
:func:`json_string_value()` internally, so it exists as long as
there are still references to the corresponding JSON string.
``s%`` (string) [const char \*, size_t *]
Convert a JSON string to a pointer to a NULL terminated UTF-8
string and its length.
.. versionadded:: 2.6
``n`` (null)
Expect a JSON null value. Nothing is extracted.

View File

@ -19,15 +19,8 @@ Strings
=======
JSON strings are mapped to C-style null-terminated character arrays,
and UTF-8 encoding is used internally. Strings may not contain
embedded null characters, not even escaped ones.
For example, trying to decode the following JSON text leads to a parse
error::
["this string contains the null character: \u0000"]
All other Unicode codepoints U+0001 through U+10FFFF are allowed.
and UTF-8 encoding is used internally. All Unicode codepoints U+0000
through U+10FFFF are allowed.
Unicode normalization or any other transformation is never performed
on any strings (string values or object keys). When checking for