Inhaltsverzeichnis

std.json

JSON-Parser und -Serialisierer für alle JSON-Typen (null, bool, number, string, array, object). Intern wird JSON als Pipe-separiertes Array-Format verarbeitet. isValidJSON prüft Wohlgeformtheit, parseValue/serializeValue konvertieren zwischen JSON-String und Lyx-Typen, stringify serialisiert ein Pipe-Array zurück zu JSON.

Einsatzbereiche: REST-API-Kommunikation, Konfigurationsdateien, Datenaustausch zwischen Microservices, Verarbeitung von HTTP-Antworten aus std.net.http und std.net.https.

Autor: Andreas Röne
Copyright: 2024-2025 Andreas Röne


Imports


Konstanten

Name Typ Wert Sichtbarkeit
JSON_NULL int64 0 pub
JSON_BOOL int64 1 pub
JSON_NUMBER int64 2 pub
JSON_STRING int64 3 pub
JSON_ARRAY int64 4 pub
JSON_OBJECT int64 5 pub
ERR_JSON_OK int64 0 pub
ERR_JSON_INVALID int64 1 pub
ERR_JSON_EXPECTED int64 2 pub
ERR_JSON_EOF int64 3 pub
ERR_JSON_ESCAPE int64 4 pub

Funktionen

Signatur Sichtbarkeit Beschreibung
json_is_ws(c: int64): int64 priv Prüft ob Zeichen JSON-Whitespace ist
find_matching(s: pchar, start: int64, open: int64, close: int64): int64 priv Findet schließendes Klammer-Gegenstück intern
count_array_elements(s: pchar, start: int64, end: int64): int64 priv Zählt Elemente in JSON-Array intern
JSONEscape(dest: pchar, src: pchar): pchar pub Maskiert Sonderzeichen für JSON-String
JSONUnescape(dest: pchar, src: pchar): pchar priv Entmaskiert JSON-Escape-Sequenzen intern
isValidJSON(s: pchar): bool pub Prüft ob String wohlgeformtes JSON ist
parseArray(dest: pchar, src: pchar): int64 pub Parst JSON-Array in Pipe-Array-Format
serializeArray(dest: pchar, src: pchar): pchar pub Serialisiert Pipe-Array zurück zu JSON-Array
parseValue(dest: pchar, src: pchar): int64 pub Parst einzelnen JSON-Wert in Lyx-Typ
serializeValue(dest: pchar, value: pchar, json_type: int64): pchar pub Serialisiert Lyx-Wert zu JSON-String
toArray(dest: pchar, json_str: pchar): pchar pub Konvertiert JSON-String zu Pipe-Array
stringify(dest: pchar, pipe_str: pchar): pchar pub Serialisiert Pipe-Array zu JSON-String