on master help sign in
Merge pull request #1273 from tinnus-napbus/json-guide-tweak

json-guide: add note about foo+bar syntax

commitaf6ee774fe8d44bfb0e0bf10a9e1e5c919f871fa authortinnus-napbus <77721746+tinnus-napbus@users.noreply.github.com> dateThu 9 Dec 2021, 21:54 (5 years ago) parent6ee82bd619a8a8
1 file changed+2
content/docs/hoon/guides/json-guide.md+2
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: