File tree 1 file changed +14
-5
lines changed
src/main/java/de/arraying/kotys
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -130,16 +130,25 @@ T mapTo(JSON json, String... ignoredJSONKeys)
130
130
if (!json .has (key )) {
131
131
continue ;
132
132
}
133
+ Class <?> type = field .getType ();
133
134
Object rawValue = json .object (key );
134
135
Object value ;
135
136
if (rawValue instanceof JSON ) {
136
- value = ((JSON ) rawValue ).marshal (field .getType ());
137
+ if (type .equals (JSON .class )) {
138
+ value = rawValue ;
139
+ } else {
140
+ value = ((JSON ) rawValue ).marshal (type );
141
+ }
137
142
} else if (rawValue instanceof JSONArray ) {
138
- Class <?> fieldType = field .getType ().getComponentType ();
139
- if (fieldType .isPrimitive ()) {
140
- throw new IllegalArgumentException ("Array type " + fieldType + " is primitive" );
143
+ if (type .equals (JSONArray .class )) {
144
+ value = rawValue ;
145
+ } else {
146
+ Class <?> fieldType = type .getComponentType ();
147
+ if (fieldType .isPrimitive ()) {
148
+ throw new IllegalArgumentException ("Array type " + fieldType + " is primitive" );
149
+ }
150
+ value = ((JSONArray ) rawValue ).marshal (fieldType );
141
151
}
142
- value = ((JSONArray ) rawValue ).marshal (fieldType );
143
152
} else {
144
153
value = rawValue ;
145
154
}
You can’t perform that action at this time.
0 commit comments