blob: ce11d7fd3d2a6699ec508097f78883967f03713e [file] [log] [blame] [view]
[TOC](Readme.md) [Prev](stringlit.md) [Next](scopes.md)
_JSON Sugar and other Goodness_
# Bytes
CUE distinguishes between a `string` and a `bytes` type.
Bytes are converted to base64 when emitting JSON.
Byte literals are defined with single quotes.
The following additional escape sequences are allowed in byte literals:
\xnn // arbitrary byte value defined as a 2-digit hexadecimal number
\0nnn // arbitrary byte value defined as a 3-digit octal number
<!-- jba: this contradicts the spec, which has \nnn (no leading zero) -->
<!-- CUE editor -->
```
a: '\x03abc'
```
<!-- JSON result -->
```json
{
a: "A2FiYw=="
}
```