Some fields have names that are not valid CUE identifiers. This Commented CUE demonstrates how to refer to these fields, both at CUE’s top level and elsewhere.

package example

// data.cue contains fields we want to refer to
// in file.cue

"top level field": "a top-level value"

aStruct: "nested field": "a nested value"
package example

// Declare an alias
X="top level field": _

output: {
	// Use the alias to refer to a top-level
	// field's value
	topLevelField: X

	// Use index notation to refer to a
	// non-top-level field's value
	nestedField: aStruct["nested field"]
$ cue export -e output
    "topLevelField": "a top-level value",
    "nestedField": "a nested value"