Skip to content

Commit 9da58e3

Browse files
authored
Merge pull request #310 from neuroglia-io/fix-dynamic-casing
Fixed casing issues during serialization of Dynamic values. The casing of dynamic value property names should now be preserved.
2 parents 0c75f0c + f722193 commit 9da58e3

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/core/Synapse.Integration/Serialization/Converters/FilteredExpandoObjectConverter.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
using Newtonsoft.Json;
1919
using Newtonsoft.Json.Converters;
20-
using Newtonsoft.Json.Serialization;
2120
using System.Dynamic;
2221

2322
namespace Synapse.Integration.Serialization.Converters
@@ -30,30 +29,16 @@ public class FilteredExpandoObjectConverter
3029
: ExpandoObjectConverter
3130
{
3231

33-
/// <summary>
34-
/// Initializes a new <see cref="FilteredExpandoObjectConverter"/>
35-
/// </summary>
36-
/// <param name="namingStrategy">The <see cref="Newtonsoft.Json.Serialization.NamingStrategy"/> to use</param>
37-
public FilteredExpandoObjectConverter(NamingStrategy namingStrategy = null)
38-
{
39-
this.NamingStrategy = namingStrategy ?? new CamelCaseNamingStrategy();
40-
}
41-
4232
/// <inheritdoc/>
4333
public override bool CanWrite => true;
4434

45-
/// <summary>
46-
/// Gets the <see cref="Newtonsoft.Json.Serialization.NamingStrategy"/> to use
47-
/// </summary>
48-
protected NamingStrategy NamingStrategy { get; }
49-
5035
/// <inheritdoc/>
5136
public override void WriteJson(JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
5237
{
5338
var expando = (IDictionary<string, object>)value;
5439
var dictionary = expando
5540
.Where(p => p.Value is not null)
56-
.ToDictionary(p => this.NamingStrategy.GetPropertyName(p.Key, false), p => p.Value);
41+
.ToDictionary(p => p.Key, p => p.Value);
5742
serializer.Serialize(writer, dictionary);
5843
}
5944

0 commit comments

Comments
 (0)