@@ -52,14 +52,8 @@ private static LogEventPropertyValue Destructure(JArray ja, ILogEventPropertyVal
52
52
return new SequenceValue ( elems ) ;
53
53
}
54
54
55
- private static LogEventPropertyValue Destructure ( JObject jo , ILogEventPropertyValueFactory propertyValueFactory )
56
- {
57
- return jo . Properties ( ) . All ( prop => LogEventProperty . IsValidName ( prop . Name ) ) ?
58
- DestructureToStructureValue ( jo , propertyValueFactory ) :
59
- DestructureToDictionaryValue ( jo , propertyValueFactory ) ;
60
- }
61
55
62
- private static LogEventPropertyValue DestructureToStructureValue ( JObject jo , ILogEventPropertyValueFactory propertyValueFactory )
56
+ private static LogEventPropertyValue Destructure ( JObject jo , ILogEventPropertyValueFactory propertyValueFactory )
63
57
{
64
58
string typeTag = null ;
65
59
var props = new List < LogEventProperty > ( jo . Count ) ;
@@ -74,6 +68,10 @@ private static LogEventPropertyValue DestructureToStructureValue(JObject jo, ILo
74
68
continue ;
75
69
}
76
70
}
71
+ else if ( ! LogEventProperty . IsValidName ( prop . Name ) )
72
+ {
73
+ return DestructureToDictionaryValue ( jo , propertyValueFactory ) ;
74
+ }
77
75
78
76
props . Add ( new LogEventProperty ( prop . Name , propertyValueFactory . CreatePropertyValue ( prop . Value , true ) ) ) ;
79
77
}
@@ -84,11 +82,11 @@ private static LogEventPropertyValue DestructureToStructureValue(JObject jo, ILo
84
82
private static LogEventPropertyValue DestructureToDictionaryValue ( JObject jo , ILogEventPropertyValueFactory propertyValueFactory )
85
83
{
86
84
var elements = jo . Properties ( ) . Select (
87
- prop =>
88
- new KeyValuePair < ScalarValue , LogEventPropertyValue > (
89
- new ScalarValue ( prop . Name ) ,
90
- propertyValueFactory . CreatePropertyValue ( prop . Value , true )
91
- )
85
+ prop =>
86
+ new KeyValuePair < ScalarValue , LogEventPropertyValue > (
87
+ new ScalarValue ( prop . Name ) ,
88
+ propertyValueFactory . CreatePropertyValue ( prop . Value , true )
89
+ )
92
90
) ;
93
91
return new DictionaryValue ( elements ) ;
94
92
}
0 commit comments