JsonIgnore to ignore field
See original GitHub issueDuring the mapping process, the AutoMap
will use the JsonProperty
to get the name of the property, but it will not follow a JsonIgnore
attribute to ignore the field from the mapping. Currently I am just putting [Object(Ignore = true)]
everywhere that I have a JsonIgnore
attribute.
E.g. (just a random example)
public string CultureInfoID { get; set; }
[JsonIgnore]
[Object(Ignore = true)]
public CultureInfo CultureInfo
{
get
{
return new CultureInfo(CultureInfoID, false);
}
}
I am not sure if this is correct. Should it not follow the JsonIgnore
attribute and not map the field? Kind of feels inconsistent, or is this the expected behavior?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Ignore fields from Java object dynamically while sending ...
Yes, you can specify which fields are serialized as JSON response and which to ignore. This is what you need to do to...
Read more >Jackson Ignore Properties on Marshalling
This tutorial will show how to ignore certain fields when serializing an object to JSON using Jackson 2.x.
Read more >How can we ignore the fields during JSON serialization in ...
If there are fields in Java objects that do not wish to be serialized, we can use the @JsonIgnore annotation in the Jackson...
Read more >How to ignore properties with System.Text.Json
To ignore individual properties, use the [JsonIgnore] attribute. The following example shows a type to serialize. It also shows the JSON ...
Read more >Jackson @JsonIgnore, @JsonIgnoreProperties and ...
In this tutorial, I show you how to ignore certain fields when serializing an object to JSON using Jackson @JsonIgnore, @JsonIgnoreProperties and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We adhere to
[JsonProperty(Name="")]
when callingAutoMap()
by virtue ofPropertyName
supporting it. I think the principle of least surprise here is that we also ignore properties marked withJsonIgnore
when callingAutoMap()
as at index time they will never be indexed anyway.Will push a fix shortly
NEST 6.6.0 and