SNOBOL4JSON(3)
π SNOBOL4JSON(3) π
okay bestie, so this is the JSON Encoding and Decoding page from the CSNOBOL4 Manual, and it's literally the whole vibe for turning SNOBOL4 data into JSON and back again. let's get into it π«Ά
β¨ NAME β¨
JSON Encoding and Decoding β that's the whole job, no notes π
π SYNOPSYS π
(yeah it's spelled like that, we don't fix it, we respect it)
-INCLUDE 'json.sno'
string = JSON_ENCODE(data)
data = JSON_DECODE(string)
so you pull in json.sno with -INCLUDE, and then you've got two besties: JSON_ENCODE(data) gives you back a string, and JSON_DECODE(string) gives you back your data. iconic duo fr fr β¨
πΈ DESCRIPTION πΈ
π¦ JSON_ENCODE(data) β data goes in, JSON string comes out
not every type gets an invite to this party ngl. it accepts a subset of SNOBOL4 data types:
STRINGπINTEGERπREALπARRAYβ but bestie, it MUST be singly-dimensioned and zero-based. that's not a suggestion, that's the law πTABLEπ
π§ JSON_DECODE(json_string) β JSON string goes in, data comes out
this one accepts a proper subset of JSON, which lowkey means there are limits and omissions, and you need to know them:
- arrays must have at least one item. an empty array? not on the menu π
- escapes can only be used for ASCII (
00-7F) characters. trueandfalseare not accepted. not me getting rejected by a parser π
NOTE!!! π₯ JSON is defined to use UTF-8 encoding, but this is not enforced by this library. so if you're exchanging binary data with other software that does enforce only-UTF-8 sequences, you should encode those binary strings (eg with base64) into ASCII sequences. do the conversion yourself, the library is not your babysitter π
π COMPATIBILITY π
https://tools.ietf.org/html/rfc8259
that's the spec, go read it, iykyk β
π SEE ALSO π
π AUTHORS π
Philip L. Budne β thank you for your service, king π«Ά
mwah, that's the whole page!! this was CSNOBOL4B 2.3.1, dated March 31, 2022, and you read every single bit of it β ate that, no crumbs, periodt π β¨
π¦ where this page comes from
- fedora 43: snobol4 2.3.1-7.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC
- fedora 43: snobol4 2.3.1-7.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC
- fedora 44: snobol4 2.3.1-8.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC
- fedora 44: snobol4 2.3.1-8.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC
- opensuse-leap 16.0: snobol4 2.3.1-160000.2.2 Β· BSD-2-Clause
- opensuse-leap 16.0: snobol4 2.3.1-160000.2.2 Β· BSD-2-Clause
- opensuse-leap 16.0: snobol4 2.3.1-160000.2.2 Β· BSD-2-Clause
- opensuse-leap 16.0: snobol4 2.3.1-160000.2.2 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms