Skip to content

encoding/json: marshal does not obey omitempty for empty structures #9585

Closed
@jordan2175

Description

@jordan2175

Given this code

https://play.golang.org/p/9Y92Vqf8Bb

you will see that I have not specified in the raw JSON data any data for the validTimePosition, however, when you run the marshal process it shows up, as illustrated below. I would expect that it would not show up at all, if it is empty.

{
"stixPackage": {
"version": "1.1.1",
"validTimePosition": {}
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions