@@ -376,12 +376,26 @@ public static void walkTree(Set<Entry<String, Object>> xmlSet, int depth, String
376376
377377 switch (entry .getValue ()) {
378378 case @ SuppressWarnings ("rawtypes" ) Map h -> {
379- walkTree (h .entrySet (), newDepth , newPath , theMap );
379+ if (Settings .getMapping ().getOrDefault (newPath , new ArrayList <>()).size () == 1
380+ && Settings .getMapping ().get (newPath ).get (0 ).isList ()) {
381+ Map <String , Object > tmpList = new HashMap <>();
382+ tmpList .put ("list" , List .of (h ));
383+ walkTree (tmpList .entrySet (), newDepth , newPath , theMap );
384+ } else {
385+ walkTree (h .entrySet (), newDepth , newPath , theMap );
386+ }
380387 }
381388 case @ SuppressWarnings ("rawtypes" ) List a -> {
382- for (Object b : a ) {
383- if (b instanceof Map ) {
384- walkTree (((Map <String , Object >) b ).entrySet (), newDepth , newPath , theMap );
389+ if (Settings .getMapping ().get (newPath ).size () == 1
390+ && Settings .getMapping ().get (newPath ).get (0 ).isList ()) {
391+ Map <String , Object > tmpList = new HashMap <>();
392+ tmpList .put ("list" , a );
393+ walkTree (tmpList .entrySet (), newDepth , newPath , theMap );
394+ } else {
395+ for (Object b : a ) {
396+ if (b instanceof Map ) {
397+ walkTree (((Map <String , Object >) b ).entrySet (), newDepth , newPath , theMap );
398+ }
385399 }
386400 }
387401 }
0 commit comments