json-guide: add note about foo+bar syntax
commit619a8a823f34f571b87f16df9fb86258b821f45d
authorTinnus Napbus <admin@tinnus-napbus.xyz>
dateThu 9 Dec 2021, 20:38 (5 years ago)
parent6761da4
content/docs/hoon/guides/json-guide.md+2
@@ -112,6 +112,8 @@ Let's have a look at a practical example. Here's a core with three arms. It has
112112--
113113```
114114
115+**Note**: This example (and a couple of others in this guide) sometimes use a syntax of `foo+bar`. This is just syntactic sugar to tag the head of `bar` with the `term` constant `%foo`, and is equivalent to `[%foo bar]`. Since `json` data is a union with head tags of `%b`, `%n`, `%s`, `%a`, or `%o`, it's sometimes convenient to do `s+'some string'`, `b+&`, etc.
116+
115117### Try it out
116118
117119First 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: