exec cue export json.cue
cmp stdout expect-stdout-cue

-- frontmatter.toml --
title = "JSON Superset"
description = ""

-- text.md --
CUE is a superset of JSON.
It adds the following conveniences:

- C-style comments,
- quotes may be omitted from field names without special characters,
- commas at the end of fields are optional,
- comma after last element in list is allowed,
- outer curly braces are optional.

<!--
{{< alert color="info">}}
CUE borrows a trick from Go to make commas optional:
the formal grammar still requires commas,
but the scanner inserts commas according to a small set
of simple rules.
{{< /alert >}}
-->

JSON objects are called structs in CUE.
An object member is called a field.

-- json.cue --
one: 1
two: 2

// A field using quotes.
"two-and-a-half": 2.5

list: [
	1,
	2,
	3,
]

-- expect-stdout-cue --
{
    "one": 1,
    "two": 2,
    "two-and-a-half": 2.5,
    "list": [
        1,
        2,
        3
    ]
}
