@@ -0,0 +1,511 @@
1++++
2+title = "JSON"
3+weight = 4
4+template = "doc.html"
5++++
6+
7+If you are working on a Gall agent with any kind of web interface, it's likely you will encounter the problem of converting Hoon data structures to JSON and vice versa. This is what we'll look at in this document.
8+
9+Urbit represents JSON data with the `$json` structure (defined in `lull.hoon`). You can refer to the [json type](#the-json-type) section below for details.
10+
11+JSON data on the web is encoded in text, so Urbit has two functions in `zuse.hoon` for dealing with this:
12+
13+- [`+en-json:html`](/docs/hoon/reference/zuse/2e_2-3#en-jsonhtml) - For printing `$json` to a text-encoded form.
14+- [`+de-json:html`](/docs/hoon/reference/zuse/2e_2-3#de-jsonhtml) - For parsing text-encoded JSON to a `$json` structure.
15+
16+You typically want `$json` data converted to some other `noun` structure or vice versa, so Urbit has three collections of functions for this purpose, also in `zuse.hoon`:
17+
18+- [`+enjs:format`](/docs/hoon/reference/zuse/2d_1-5#enjsformat) - Functions for converting various atoms and structures to `$json`.
19+- [`+dejs:format`](/docs/hoon/reference/zuse/2d_6#dejsformat) - Many "reparsers" for converting `$json` data to atoms and other structures.
20+- [`+dejs-soft:format`](/docs/hoon/reference/zuse/2d_7#dejs-softformat) - Largely the same as `+dejs:format` except its reparsers produce `unit`s which are null upon failure rather than simply crashing.
21+
22+The relationship between these types and functions look like this:
23+
24+
25+
26+Note this diagram is a simplification - the `+dejs:format` and `+enjs:format` collections in particular are tools to be used in writing conversion functions rather than simply being used by themselves, but it demonstrates the basic relationships. Additionally, it is less common to do printing/parsing manually - this would typically be handled automatically by Eyre, though it may be necessary if you're retrieving JSON data via the web client vane Iris.
27+
28+### In practice
29+
30+A typical Gall agent will have a number of structures defined in a file in the `/sur` directory. These will define the type of data it expects to be `%poke`ed with, the type of data it will `%give` to subscribers, and the type of data its scry endpoints produce.
31+
32+If the agent only interacts with other agents inside Urbit, it may just use a `%noun` `mark`. If, however, it needs to talk to a web interface of some kind, it usually must handle `$json` data with a `%json` mark.
33+
34+Sometimes an agent's interactions with a web interface are totally distinct from its interactions with other agents. If so, the agent could just have separate scry endpoints, poke handlers, etc, that directly deal with `$json` data with a `%json` mark. In such a case, you can include `$json` encoding/decoding functions directly in the agent or associated libraries, using the general techniques demonstrated in the [$json encoding and decoding example](#json-encoding-and-decoding-example) section below.
35+
36+If, on the other hand, you want a unified interface (whether interacting with a web client or within Urbit), a different approach is necessary. Rather than taking or producing either `%noun` or `%json` marked data, custom `mark` files can be created which specify conversion methods for both `%noun` and `%json` marked data.
37+
38+With this approach, an agent would take and/or produce data with some `mark` like `%my-custom-mark`. Then, when the agent must interact with a web client, the webserver vane Eyre can automatically convert `%my-custom-mark` to `%json` or vice versa. This way the agent only ever has to handle the `%my-custom-mark` data. This approach is used by `%graph-store` with its `%graph-update-2` mark, for example, and a number of other agents.
39+
40+For details of creating a `mark` file for this purpose, the [mark file example](#mark-file-example) section below walks through a practical example.
41+
42+## The `$json` type
43+
44+Urbit represents JSON data with the `$json` structure (defined in `/sys/lull.hoon`):
45+
46+```hoon
47++$ json :: normal json value
48+ $@ ~ :: null
49+ $% [%a p=(list json)] :: array
50+ [%b p=?] :: boolean
51+ [%o p=(map @t json)] :: object
52+ [%n p=@ta] :: number
53+ [%s p=@t] :: string
54+ == ::
55+```
56+
57+The correspondence of `$json` to JSON types is fairly self-evident, but here's a table comparing the two for additional clarity:
58+
59+| JSON Type | `$json` Type | JSON Example | `$json` Example |
60+| :-------- | :--------------------- | ------------------------- | :----------------------------------------------------------- |
61+| Null | `~` | `null` | `~` |
62+| Boolean | `[%b p=?]` | `true` | `[%b p=%.y]` |
63+| Number | `[%n p=@ta]` | `123` | `[%n p=~.123]` |
64+| String | `[%s p=@t]` | `"foo"` | `[%s p='foo']` |
65+| Array | `[%a p=(list json)]` | `["foo",123]` | `[%a p=~[[%s p='foo'] [%n p=~.123]]]` |
66+| Object | `[%o p=(map @t json)]` | `{"foo":"xyz","bar":123}` | `[%o p={[p='bar' q=[%n p=~.123]] [p='foo' q=[%s p='xyz']]}]` |
67+
68+Since the `$json` `%o` object and `%a` array types may themselves contain any `$json`, you can see how JSON structures of arbitrary complexity can be represented. Note the `%n` number type is a `@ta` rather than something like a `@ud` that you might expect. This is because JSON's number type may be either an integer or floating point, so it's left as a `knot` which can then be parsed to a `@ud` or `@rd` with the appropriate [`+dejs:format`](/docs/hoon/reference/zuse/2d_6) function.
69+
70+## `$json` encoding and decoding example
71+
72+Let's have a look at a practical example. Here's a core with three arms. It has the structure arm `$user`, and then two more: `+to-js` converts a `$user` structure to `$json`, and `+from-js` does the opposite. Usually we'd define the structure in a separate `/sur` file, but for simplicity it's all in the one core.
73+
74+#### `json-test.hoon`
75+
76+```hoon
77+|%
78++$ user
79+ $: username=@t
80+ name=[first=@t mid=@t last=@t]
81+ joined=@da
82+ email=@t
83+ ==
84+++ to-js
85+ |= usr=user
86+ |^ ^- json
87+ %- pairs:enjs:format
88+ :~
89+ ['username' s+username.usr]
90+ ['name' name]
91+ ['joined' (sect:enjs:format joined.usr)]
92+ ['email' s+email.usr]
93+ ==
94+ ++ name
95+ :- %a
96+ :~
97+ [%s first.name.usr]
98+ [%s mid.name.usr]
99+ [%s last.name.usr]
100+ ==
101+ --
102+++ from-js
103+ =, dejs:format
104+ ^- $-(json user)
105+ %- ot
106+ :~
107+ [%username so]
108+ [%name (at ~[so so so])]
109+ [%joined du]
110+ [%email so]
111+ ==
112+--
113+```
114+
115+### Try it out
116+
117+First we'll try using our `$json` encoding/decoding library, and afterwards we'll take a closer look at its construction. To begin, save the code above in `/lib/json-test.hoon` of the `%base` desk on a fake ship and `|commit` it:
118+
119+```
120+> |commit %base
121+>=
122++ /~zod/base/5/lib/json-test/hoon
123+```
124+
125+Then we need to build it so we can use it. We'll give it a face of `user-lib`:
126+
127+```
128+> =user-lib -build-file %/lib/json-test/hoon
129+```
130+
131+Let's now create an example of a `$user` structure:
132+
133+```
134+> =usr `user:user-lib`['john456' ['John' 'William' 'Smith'] now 'john.smith@example.com']
135+> usr
136+[ username='john456'
137+ name=[first='John' mid='William' last='Smith']
138+ joined=~2021.9.12..09.47.58..1b65
139+ email='john.smith@example.com'
140+]
141+```
142+
143+Now we can try calling the `+to-js` function with our data to convert it to `$json`:
144+
145+```
146+> =usr-json (to-js:user-lib usr)
147+> usr-json
148+[ %o
149+ p
150+ { [p='email' q=[%s p='john.smith@example.com']]
151+ [p='name' q=[%a p=~[[%s p='John'] [%s p='William'] [%s p='Smith']]]]
152+ [p='username' q=[%s p='john456']]
153+ [p='joined' q=[%n p=~.1631440078]]
154+ }
155+]
156+```
157+
158+Let's also see how that `$json` would look as real JSON encoded in text. We can do that with `+en-json:html`:
159+
160+```
161+> (crip (en-json:html (to-js:user-lib usr)))
162+'{"joined":1631440078,"username":"john456","name":["John","William","Smith"],"email":"john.smith@example.com"}'
163+```
164+
165+Finally, let's try converting the `$json` back to a `$user` again with our `+from-js` arm:
166+
167+```
168+> (from-js:user-lib usr-json)
169+[ username='john456'
170+ name=[first='John' mid='William' last='Smith']
171+ joined=~2021.9.12..09.47.58
172+ email='john.smith@example.com'
173+]
174+```
175+
176+### Analysis
177+
178+#### Converting to `$json`
179+
180+Here's our arm that converts a `$user` structure to `$json`:
181+
182+```hoon
183+++ to-js
184+ |= usr=user
185+ |^ ^- json
186+ %- pairs:enjs:format
187+ :~
188+ ['username' s+username.usr]
189+ ['name' name]
190+ ['joined' (sect:enjs:format joined.usr)]
191+ ['email' s+email.usr]
192+ ==
193+ ++ name
194+ :- %a
195+ :~
196+ [%s first.name.usr]
197+ [%s mid.name.usr]
198+ [%s last.name.usr]
199+ ==
200+ --
201+```
202+
203+There are different ways we could represent our `$user` structure as JSON, but in this case we've opted to encapsulate it in an object and have the `name` as an array (since JSON arrays preserve order).
204+
205+[`+enjs:format`](/docs/hoon/reference/zuse/2d_1-5#enjsformat)includes the convenient [`+pairs`](/docs/hoon/reference/zuse/2d_1-5#pairsenjsformat) function, which converts a list of `[@t json]` to an object containing those key-value pairs. We've used this to assemble the final object. Note that if you happen to have only a single key-value pair rather than a list, you can use [`+frond`](/docs/hoon/reference/zuse/2d_1-5#frondenjsformat) instead of `+pairs`.
206+
207+For the `joined` field, we've used the [`+sect`](/docs/hoon/reference/zuse/2d_1-5#sectenjsformat) function from `+enjs` to convert the `@da` to a Unix seconds timestamp in a `$json` number. The `+sect` function, like others in `+enjs`, takes in a noun (in this case a `@da`) and produces `$json` (in this case a `[%n @ta]` number). `+enjs` contains a handful of useful functions like this, but for the rest we've just hand-made the `$json` structure. This is fairly typical when encoding `$json`, it's usually [decoding](#converting-from-json) that makes more extensive use of the `$json` utility functions in `+format`.
208+
209+For the `name` field we've just formed a cell of `%a` and a list of `$json` strings, since a `$json` array is `[%a p=(list json)]`. Note we've separated this part into its own arm and wrapped the whole thing in a `|^` - a core with a `$` arm that's computed immediately. This is simply for readability - our structure here is quite simple but when dealing with deeply-nested `$json` structures or complex logic, having a single giant function can quickly become unwieldy.
210+
211+#### Converting from `$json`
212+
213+Here's our arm that converts `$json` to our `$user` structure:
214+
215+```hoon
216+++ from-js
217+ =, dejs:format
218+ ^- $-(json user)
219+ %- ot
220+ :~
221+ [%username so]
222+ [%name (at ~[so so so])]
223+ [%joined du]
224+ [%email so]
225+ ==
226+```
227+
228+This is the inverse of the [encoding](#converting-to-json) function described in the previous section.
229+
230+We make extensive use of [`+dejs:format`](/docs/hoon/reference/zuse/2d_6) functions here, so we've used `=,` to expose the namespace and allow succinct `+dejs` function calls.
231+
232+We use the [`+ot`](/docs/hoon/reference/zuse/2d_6#otdejsformat) function from `+dejs:format` to decode the `$json` object to a n-tuple. It's a wet gate that takes a list of pairs of keys and other `+dejs` functions and produces a new gate that takes the `$json` to be decoded (which we've given it in `jon`).
233+
234+The [`+so`](/docs/hoon/reference/zuse/2d_6#sodejsformat) functions just decode `$json` strings to `cord`s. The [`+at`](/docs/hoon/reference/zuse/2d_6#atdejsformat) function converts a `$json` array to a tuple, decoding each element with the respective function given in its argument list. Like `+ot`, `+at` is also a wet gate that produces a gate that takes `$json`. In our case we've used `+so` for each element, since they're all strings.
235+
236+For `joined`, we've used the [`+du`](/docs/hoon/reference/zuse/2d_6#dudejsformat) function, which converts a Unix seconds timestamp in a `$json` number to a `@da` (it's basically the inverse of the `+sect:enjs:format` we used earlier).
237+
238+Notice how `+ot` takes in other `+dejs` functions in its argument. One of its arguments includes the `+at` function which itself takes in other `+dejs` functions. There are several `+dejs` functions like this that allow complex nested JSON structures to be decoded. For other examples of common `+dejs` functions like this, see the [More `+dejs`](#more-dejs) section below.
239+
240+There are dozens of different functions in [`+dejs:format`](/docs/hoon/reference/zuse/2d_6) that will cover a great many use cases. If there isn't a `+dejs` function for a particular case, you can also just write a custom function - it just has to take `$json`. Note there's also the [`+dejs-soft:format`](/docs/hoon/reference/zuse/2d_7) functions - these are similar to `+dejs` functions except they produce `unit`s rather than simply crashing if decoding fails.
241+
242+## More `+dejs`
243+
244+We looked at the commonly used `+ot` function in the [first example](#converting-from-json), now let's look at a couple more common `+dejs` functions.
245+
246+### `+of`
247+
248+The [`+of`](/docs/hoon/reference/zuse/2d_6#ofdejsformat) function takes an object containing a single key-value pair, decodes the value with the corresponding `+dejs` function in a key-function list, and produces a key-value tuple. This is useful when there are multiple possible objects you might receive, and tagged unions are a common data structure in hoon.
249+
250+Let's look at an example. Here's a gate that takes in some `$json`, decodes it with an `+of` function that can handle three possible objects, casts the result to a tagged union, switches against its head with `?-`, performs some transformation and finally returns the result. You can save it as `gen/of-test.hoon` in the `%base` desk of a fake ship and `|commit %base`.
251+
252+#### `of-test.hoon`
253+
254+```hoon
255+|= jon=json
256+|^ ^- @t
257+=/ =fbb
258+ (to-fbb jon)
259+?- -.fbb
260+ %foo (cat 3 +.fbb '!!!')
261+ %bar ?:(+.fbb 'Yes' 'No')
262+ %baz :((cury cat 3) p.fbb q.fbb r.fbb)
263+==
264++$ fbb
265+ $% [%foo @t]
266+ [%bar ?]
267+ [%baz p=@t q=@t r=@t]
268+ ==
269+++ to-fbb
270+=, dejs:format
271+%- of
272+:~ foo+so
273+ bar+bo
274+ baz+(at ~[so so so])
275+==
276+--
277+```
278+
279+Let's try it:
280+
281+```
282+> +of-test (need (de-json:html '{"foo":"Hello"}'))
283+'Hello!!!'
284+
285+> +of-test (need (de-json:html '{"bar":true}'))
286+'Yes'
287+
288+> +of-test (need (de-json:html '{"baz":["a","b","c"]}'))
289+'abc'
290+```
291+
292+### `+ou`
293+
294+The [`+ou`](/docs/hoon/reference/zuse/2d_6#oudejsformat) function decodes a `$json` object to an n-tuple using the matching functions in a key-function list. Additionally, it lets you set some key-value pairs in an object as optional and others as mandatory. The mandatory ones crash if they're missing and the optional ones are replaced with a given noun.
295+
296+`+ou` is different to other `+dejs` functions - the functions it takes are `$-((unit json) grub)` rather than the usual `$-(json grub)` of most `+dejs` functions. There are only two `+dejs` functions that fit this - [`+un`](/docs/hoon/reference/zuse/2d_6#undejsformat) and [`+uf`](/docs/hoon/reference/zuse/2d_6#ufdejsformat). These are intended to be used with `+ou` - you would wrap each function in the key-function list of `+ou` with either `+un` or `+uf`.
297+
298+`+un` crashes if its argument is `~`. `+ou` gives functions a `~` if the matching key-value pair is missing in the `$json` object, so `+un` crashes if the key-value pair is missing. Therefore, `+un` lets you set key-value pairs as mandatory.
299+
300+`+uf` takes two arguments - a noun and a `+dejs` function. If the `(unit json)` it's given by `+ou` is `~`, it produces the noun it was given rather than the product of the `+dejs` function. This lets you specify key-value pairs as optional, replacing missing ones with whatever you want.
301+
302+Let's look at a practical example. Here's a generator you can save in the `%base` desk of a fake ship in `gen/ou-test.hoon` and `|commit %base`. It takes in a `$json` object and produces a triple. The `+ou` in `+decode` has three key-function pairs - the first two are mandatory and the last is optional, producing the bunt of a set if the `%baz` key is missing.
303+
304+#### `ou-test.hoon`
305+
306+```hoon
307+|= jon=json
308+|^ ^- [@t ? (set @ud)]
309+(decode jon)
310+++ decode
311+=, dejs:format
312+%- ou
313+:~ foo+(un so)
314+ bar+(un bo)
315+ baz+(uf *(set @ud) (as ni))
316+==
317+--
318+```
319+
320+Let's try it:
321+
322+```
323+> +ou-test (need (de-json:html '{"foo":"hello","bar":true,"baz":[1,2,3,4]}'))
324+['hello' %.y {1 2 3 4}]
325+
326+> +ou-test (need (de-json:html '{"foo":"hello","bar":true}'))
327+['hello' %.y {}]
328+
329+> +ou-test (need (de-json:html '{"foo":"hello"}'))
330+[%key 'bar']
331+dojo: hoon expression failed
332+```
333+
334+### `+su`
335+
336+The [`+su`](/docs/hoon/reference/zuse/2d_6#sudejsformat) function parses a string with the given parsing `rule`. Hoon's functional parsing library is very powerful and lets you create arbitrarily complex parsers. JSON will often have data types encoded in strings, so this function can be very useful. The writing of parsers is outside the scope of this guide, but you can see the [Parsing Guide](/docs/hoon/guides/parsing) and sections 4e to 4j of the standard library documentation for details.
337+
338+Here are some simple examples of using `+su` to parse strings:
339+
340+```
341+> `@ux`((su:dejs:format hex) s+'deadbeef1337f00D')
342+0xdead.beef.1337.f00d
343+
344+> `(list @)`((su:dejs:format (most lus dem)) s+'1+2+3+4')
345+~[1 2 3 4]
346+
347+> `@ub`((su:dejs:format ven) s+'+>-<->+<+')
348+0b11.1000.1101
349+```
350+
351+Here's a more complex parser that will parse a GUID like `824e7749-4eac-9c00-db16-4cb816cd6f19` to a `@ux`:
352+
353+#### `su-test.hoon`
354+
355+```hoon
356+|= jon=json
357+^- @ux
358+%. jon
359+%- su:dejs:format
360+%+ cook
361+|= parts=(list [step @])
362+^- @ux
363+(can 3 (flop parts))
364+;~ plug
365+ (stag 4 ;~(sfix (bass 16 (stun 8^8 six:ab)) hep))
366+ (stag 2 ;~(sfix qix:ab hep))
367+ (stag 2 ;~(sfix qix:ab hep))
368+ (stag 2 ;~(sfix qix:ab hep))
369+ (stag 6 (bass 16 (stun 12^12 six:ab)))
370+ (easy ~)
371+==
372+```
373+
374+Save it in the `/gen` directory of the `%base` desk and `|commit` it. We can then try it with:
375+
376+```
377+> +su-test s+'5323a61d-0c26-d8fa-2b73-18cdca805fd8'
378+0x5323.a61d.0c26.d8fa.2b73.18cd.ca80.5fd8
379+```
380+
381+If we delete the last character it'll no longer be a valid GUID and the parsing will fail:
382+
383+```
384+> +su-test s+'5323a61d-0c26-d8fa-2b73-18cdca805fd'
385+/gen/su-test/hoon:<[2 1].[16 3]>
386+/gen/su-test/hoon:<[3 1].[16 3]>
387+{1 36}
388+syntax error
389+dojo: naked generator failure
390+```
391+
392+## `mark` file example
393+
394+Here's a simple `mark` file for the `$user` structure we created in the [first example](#json-encoding-and-decoding-example). It imports the [json-test.hoon](#json-testhoon) library we created and saved in our `%base` desk's `/lib` directory.
395+
396+#### `user.hoon`
397+
398+```hoon
399+/+ *json-test
400+|_ usr=user
401+++ grab
402+ |%
403+ ++ noun user
404+ ++ json from-js
405+ --
406+++ grow
407+ |%
408+ ++ noun usr
409+ ++ json (to-js usr)
410+ --
411+++ grad %noun
412+--
413+```
414+
415+The [Marks section](/docs/arvo/clay/marks/marks) of the Clay documentation covers `mark` files comprehensively and is worth reading through if you want to write a mark file.
416+
417+In brief, a mark file contains a `door` with three arms. The door's sample type is the type of the data in question - in our case the `$user` structure. The `+grab` arm contains methods for converting _to_ our mark, and the `+grow` arm contains methods for converting _from_ our mark. The `+noun` arms are mandatory, and then we've added `+json` arms which respectively call the `+from-js` and `+to-js` functions from our `json-test.hoon` library. The final `+grad` arm defines various revision control functions, in our case we've delegated these to the `%noun` mark.
418+
419+From this mark file, Clay can build mark conversion gates between the `%json` mark and our `%user` mark, allowing the conversion of `$json` data to a `$user` structure and vice versa.
420+
421+### Try it out
422+
423+First, we'll save the code above as `user.hoon` in the `/mar` directory our of `%base` desk:
424+
425+```
426+> |commit %base
427+>=
428++ /~zod/base/9/mar/user/hoon
429+```
430+
431+Let's quickly create a `$json` object to work with:
432+
433+```
434+> =jon (need (de-json:html '{"joined":1631440078,"username":"john456","name":["John","William","Smith"],"email":"john.smith@example.com"}'))
435+> jon
436+[ %o
437+ p
438+ { [p='email' q=[%s p='john.smith@example.com']]
439+ [p='name' q=[%a p=~[[%s p='John'] [%s p='William'] [%s p='Smith']]]]
440+ [p='username' q=[%s p='john456']]
441+ [p='joined' q=[%n p=~.1631440078]]
442+ }
443+]
444+```
445+
446+We'll also build our library so we can use its types from the dojo:
447+
448+```
449+> =user-lib -build-file %/lib/json-test/hoon
450+```
451+
452+Now we can ask Clay to build a mark conversion gate from a `%json` mark to our `%user` mark. We'll use a scry with a `%f` `care` which produces a static mark conversion gate:
453+
454+```
455+> =json-to-user .^($-(json user:user-lib) %cf /===/json/user)
456+```
457+
458+Let's try converting our `$json` to a `$user` structure with our new mark conversion gate:
459+
460+```
461+> =usr (json-to-user jon)
462+> usr
463+[ username='john456'
464+ name=[first='John' mid='William' last='Smith']
465+ joined=~2021.9.12..09.47.58
466+ email='john.smith@example.com'
467+]
468+```
469+
470+Now let's try the other direction. We'll again scry Clay to build a static mark conversion gate, this time _from_ `%user` _to_ `%json` rather than the reverse:
471+
472+```
473+> =user-to-json .^($-(user:user-lib json) %cf /===/user/json)
474+```
475+
476+Let's test it out by giving it our `$user` data:
477+
478+```
479+> (user-to-json usr)
480+[ %o
481+ p
482+ { [p='email' q=[%s p='john.smith@example.com']]
483+ [p='name' q=[%a p=~[[%s p='John'] [%s p='William'] [%s p='Smith']]]]
484+ [p='username' q=[%s p='john456']]
485+ [p='joined' q=[%n p=~.1631440078]]
486+ }
487+]
488+```
489+
490+Finally, let's see how that looks as JSON encoded in text:
491+
492+```
493+> (crip (en-json:html (user-to-json usr)))
494+'{"joined":1631440078,"username":"john456","name":["John","William","Smith"],"email":"john.smith@example.com"}'
495+```
496+
497+Usually (though not in all cases) these mark conversions will be performed implicitly by Gall or Eyre and you'd not deal with the mark conversion gates directly, but it's still informative to see them work explicitly.
498+
499+## Further reading
500+
501+[The Zuse library reference](/docs/hoon/reference/zuse/table-of-contents) - This includes documentation of the JSON parsing, printing, encoding and decoding functions.
502+
503+[The Marks section of the Clay documentation](/docs/arvo/clay/marks/marks) - Comprehensive documentation of `mark`s.
504+
505+[The External API Reference section of the Eyre documentation](/docs/arvo/eyre/external-api-ref) - Details of the webserver vane Eyre's external API.
506+
507+[The Iris documentation](/docs/arvo/iris/iris) - Details of the web client vane Iris, which may be used to fetch external JSON data among other things.
508+
509+[Strings Guide](/docs/hoon/guides/strings) - Atom printing functions like `+scot` will often be useful for JSON encoding - see the [Encoding in Text](/docs/hoon/guides/strings#encoding-in-text) section for usage.
510+
511+[Parsing Guide](/docs/hoon/guides/parsing) - Learn how to write functional parsers in hoon which can be used with `+su`.