fix(encode): keep a []any of tables in the value-array form
Assisted-by: GLM 5.3
This commit is contained in:
@@ -331,6 +331,11 @@ tree, _ := interpres.Parse([]byte(`arr = [1, {a = 2}, "x"]`))
|
||||
out, _ := interpres.Marshal(tree) // arr = [1, {a = 2}, "x"]
|
||||
```
|
||||
|
||||
A `[]any` holding only tables keeps the value-array form as well, because that
|
||||
is the shape `Parse` gives a value array of inline tables; emitting it as
|
||||
`[[headers]]` would re-parse as `[]map[string]any` and change the value's type
|
||||
across a round-trip.
|
||||
|
||||
### Empty arrays
|
||||
|
||||
A nil slice is always omitted. An empty (length 0) array of tables is always
|
||||
|
||||
Reference in New Issue
Block a user