Die Oberfläche von VDS Renaissance ist in mehreren Sprachen verfügbar. Die offizielle Dokumentation wird auf Englisch gepflegt, um eine einheitliche, konsistente und stets aktuelle Referenz zu gewährleisten.
@JSON
[VDS7]
Syntax
@JSON(VALUE, <id>, <path>)
@JSON(VALUES, <id>, <path>, <key1>, <key2>, ...)
@JSON(COUNT, <id>, <path>)
@JSON(KEYS, <id>, <path>)
@JSON(TYPE, <id>, <path>)
@JSON(EXISTS, <id>, <path>)
@JSON(STRING, <id> {, <path>} {, PRETTY})
Description
This function reads from a JSON document with handle <id> created by @NEW(JSON). The first parameter selects the operation:
| VALUE | Returns the scalar value at <path>. A boolean is returned as 1 or 0; a JSON null returns an empty string. |
| VALUES | Returns several values, taken from the keys <key1>, <key2>, ... relative to <path>, joined by the current field separator. |
| COUNT | Returns the number of elements in the array or object at <path> — the basis for iteration. |
| KEYS | Returns the names of the keys of the object at <path>, joined by the current field separator. |
| TYPE | Returns the type at <path>: object, array, string, number, bool or null. |
| EXISTS | Returns 1 if <path> exists, otherwise 0. |
| STRING | Returns the document, or the sub-document at <path>, re-serialised as text (compact, or indented if PRETTY is given) — useful for sending it on to an AI or HTTP request. |
Paths use the dotted notation described under JSON documents (users.0.name).
OK
Unchanged.
Example
%h = @new(json)
json parse,%h,%response
%n = @json(count,%h,users)
%i = 0
while @less(%i,%n)
info @json(value,%h,users.%i.name) is @json(value,%h,users.%i.age)
%i = @succ(%i)
wend
json close,%h
See also
- JSON command
- @NEW function
- JSON Documents
- @AI