Skip to content

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

Open
@eponymous301

Description

@eponymous301

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"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions