TOC Prev Next

JSON Sugar and other Goodness

Quotes are Optional for Field Names

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

Double quotes may be omitted from field names if their name contains no special characters and does not start with a number:

fieldname.cue:

{
    one: 1,
    two: 2,

    "two-and-a-half": 2.5
}

$ cue export fieldname.cue

{
    "one": 1,
    "two": 2,
    "two-and-a-half": 2.5
}