botbuilder-java
botbuilder-java copied to clipboard
Ignore fields to avoid duplicating values when serializing
Description
When deserializing an Activity , teamsActivity and fromStreamingConnection are created due to the method name.
If we then serialize and deserialize it again we will end up with two properties named teamsActivity and fromStreamingConnection. This can created a few issues because it will have duplicate keys when deserialized so it's no longer a valid JSON.
Specific Changes
- Added
@JsonIgnoreto theisFromStreamingConnectionandisTeamsActivitymethods
Testing
ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());
Activity activity1 = new Activity();
String json1 = mapper.writeValueAsString(activity1);
Activity activity2 = mapper.readValue(json1, Activity.class);
String json2 = mapper.writeValueAsString(activity2);