Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a naming strategy causes private fields to be marshaled #326

Open
eponymous301 opened this issue Nov 28, 2018 · 0 comments
Open

Comments

@eponymous301
Copy link

eponymous301 commented Nov 28, 2018

I would expect private fields to only be included if I have called extra.SupportPrivateFields()

	type s struct {
		FieldName string
		privateField string
	}
	s1 := s{FieldName: "foo", privateField:"bar"}
	extra.SetNamingStrategy(extra.LowerCaseWithUnderscores)
	json1, _ := jsoniter.Marshal(s1)
	println(string(json1))

output:
{"field_name":"foo","private_field":"bar"}

AllenX2018 added a commit that referenced this issue Feb 5, 2020
zhenzou pushed a commit to zhenzou/jsoniter that referenced this issue Feb 2, 2022
zhenzou pushed a commit to zhenzou/jsoniter that referenced this issue Feb 2, 2022
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

No branches or pull requests

1 participant