blob: 77341a260c2d26b1903d65fe9d7712748d580e8e [file] [log] [blame] [view]
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01001[TOC](Readme.md) [Prev](stringlit.md) [Next](scopes.md)
2
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01003_JSON Sugar and other Goodness_
4
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# Bytes
6
7CUE distinguishes between a `string` and a `bytes` type.
8Bytes are converted to base64 when emitting JSON.
9Byte literals are defined with single quotes.
10The following additional escape sequences are allowed in byte literals:
11
12 \xnn // arbitrary byte value defined as a 2-digit hexadecimal number
13 \0nnn // arbitrary byte value defined as a 3-digit octal number
14
15
16<!-- CUE editor -->
17```
18a: '\x03abc'
19```
20
21<!-- JSON result -->
22```json
23{
24 a: "A2FiYw=="
25}
26```