Skip to content

Add JSON Marshal/Unmarshal to setof#443

Open
klauspost wants to merge 2 commits into
tinylib:masterfrom
klauspost:json-setof
Open

Add JSON Marshal/Unmarshal to setof#443
klauspost wants to merge 2 commits into
tinylib:masterfrom
klauspost:json-setof

Conversation

@klauspost
Copy link
Copy Markdown
Collaborator

Each type not also support JSON serializers so sets are stored as JSON. Sorted/Unsorted also applies here.

Mildly breaking. Open for alternatives.

Each type not also support JSON serializers so sets are stored as JSON. Sorted/Unsorted also applies here.

Mildly breaking. Open for suggestions.
Comment thread msgp/setof/json.go
i++
}
} else {
for i < len(data) && data[i] != ',' && data[i] != ']' &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you only ever use this function to parse numbers and strings, so maybe it's not a huge deal, but obviously this fails in rather pernicious ways if you have a sub-array or sub-structure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I really wish the Go team would officially release the encoding/json/v2 API because it has a public API for the lexer we could use... oh well.)

Copy link
Copy Markdown
Collaborator Author

@klauspost klauspost May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is scheduled for v1.27, but haven't followed too closely.

But yeah, made it specifically for the cases we cover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants