1- @page json_module JSON module
1+ ---
2+ title : " JSON module"
3+ description : " "
4+ summary : " "
5+ date : 2025-07-23T14:25:16+02:00
6+ lastmod : 2025-07-23T14:25:16+02:00
7+ draft : false
8+ weight : 410
9+ toc : true
10+ seo :
11+ title : " " # custom title (optional)
12+ description : " " # custom description (recommended)
13+ canonical : " " # custom canonical URL (optional)
14+ noindex : false # false (default) or true
15+ ---
16+
17+ {{< highlight_scripts >}}
218
319## json: open
420
@@ -13,9 +29,9 @@ Open a file and read its content as JSON, then return it.
1329- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
1430
1531** Example**
16- ~~~~ {.lisp }
32+ {{< highlight_arkscript >} }
1733(let json (json: open "test.json"))
18- ~~~~
34+ {{< /highlight_arkscript >}}
1935
2036## json: fromString
2137
@@ -30,9 +46,9 @@ Takes a String as an argument, representing a JSON object, and return it parsed
3046- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
3147
3248** Example**
33- ~~~~ {.lisp }
49+ {{< highlight_arkscript >} }
3450(let json (json: fromString "{\" hello\" : \" world\" , \" key\" : 12}"))
35- ~~~~
51+ {{< /highlight_arkscript >}}
3652
3753## json: get
3854
@@ -48,10 +64,10 @@ Retrieve a value from a jsonObject by its key.
4864- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
4965
5066** Example**
51- ~~~~ {.lisp }
67+ {{< highlight_arkscript >} }
5268(let json (json: fromString "{\" hello\" : \" world\" , \" key\" : 12}"))
5369(print (json: get json "hello")) # world
54- ~~~~
70+ {{< /highlight_arkscript >}}
5571
5672## json: toString
5773
@@ -66,10 +82,10 @@ Takes a jsonObject and transforms it into a String.
6682- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
6783
6884** Example**
69- ~~~~ {.lisp }
85+ {{< highlight_arkscript >} }
7086(let json (json: fromString "{\" hello\" : \" world\" , \" key\" : 12}"))
7187(print (json: toString json)) # {"hello": "world", "key": 12}
72- ~~~~
88+ {{< /highlight_arkscript >}}
7389
7490## json: set
7591
@@ -86,11 +102,11 @@ Modify a value in a jsonObject, given a key (String) and a new value.
86102- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
87103
88104** Example**
89- ~~~~ {.lisp }
105+ {{< highlight_arkscript >} }
90106(let json (json: fromString "{\" hello\" : \" world\" , \" key\" : 12}"))
91107(json: set json "hello" 14)
92108(print json) # {"hello": 14, "key": 12}
93- ~~~~
109+ {{< /highlight_arkscript >}}
94110
95111## json: fromList
96112
@@ -105,18 +121,16 @@ Take a list of an even number of values, the even ones are the keys (String) and
105121- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
106122
107123** Example**
108- ~~~~ {.lisp }
124+ {{< highlight_arkscript >} }
109125(let json (json: fromList [
110- "key" "value"
111- "keybis" 12
112- "this_is_an_array" [1 2 3]
113- "bool" true
114- "subobject" (json:fromList [
115- "a" 1
116- "b" 2
117- ])
118- ]))
119- ~~~~
126+ "key" "value"
127+ "keybis" 12
128+ "this_is_an_array" [ 1 2 3]
129+ "bool" true
130+ "subobject" (json: fromList [
131+ "a" 1
132+ "b" 2 ] )] ))
133+ {{< /highlight_arkscript >}}
120134
121135## json: write
122136
@@ -132,20 +146,18 @@ Take a jsonObject and a filename (String), and write the jsonObject to the file.
132146- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
133147
134148** Example**
135- ~~~~ {.lisp }
149+ {{< highlight_arkscript >} }
136150(let json (json: fromList [
137- "key" "value"
138- "keybis" 12
139- "this_is_an_array" [1 2 3]
140- "bool" true
141- "subobject" (json:fromList [
142- "a" 1
143- "b" 2
144- ])
145- ]))
151+ "key" "value"
152+ "keybis" 12
153+ "this_is_an_array" [ 1 2 3]
154+ "bool" true
155+ "subobject" (json: fromList [
156+ "a" 1
157+ "b" 2 ] )] ))
146158
147159(json: write json "filename.json")
148- ~~~~
160+ {{< /highlight_arkscript >}}
149161
150162## json: len
151163
@@ -158,16 +170,14 @@ Take a jsonObject and a filename (String), and write the jsonObject to the file.
158170- [ @Gryfenfer97 ] ( https://github.com/Gryfenfer97 )
159171
160172** Example**
161- ~~~~ {.lisp }
173+ {{< highlight_arkscript >} }
162174(let json (json: fromList [
163- "key" "value"
164- "keybis" 12
165- "this_is_an_array" [1 2 3]
166- "bool" true
167- "subobject" (json:fromList [
168- "a" 1
169- "b" 2
170- ])
171- ]))
175+ "key" "value"
176+ "keybis" 12
177+ "this_is_an_array" [ 1 2 3]
178+ "bool" true
179+ "subobject" (json: fromList [
180+ "a" 1
181+ "b" 2 ] )] ))
172182(json: len json) # 5
173- ~~~~
183+ {{< /highlight_arkscript >}}
0 commit comments