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
Comment thread msgp/setof/json.go
case '\t':
dst = append(dst, '\\', 't')
default:
dst = append(dst, '\\', 'u', '0', '0', hexDigit(byte(r>>4)), hexDigit(byte(r&0xf)))
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.

Doesn't JSON support the full 4 digits here? (Or, conversely, if it doesnt, then presumably you'd want to emit U+FFFD here?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You may very well be right. Actually, let me set up a fuzz test. Way easier to find roundtrip problems/disceptencies.

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