Added writing the key for arrays

This commit is contained in:
imbeacon 2023-04-25 09:14:48 +03:00
parent 7ea35aa95a
commit 4d46bc1131

View File

@ -376,7 +376,14 @@ public class TbUtils {
if (pathInKey) { if (pathInKey) {
map.put(path, json); map.put(path, json);
} else { } else {
String key = path.contains(".") ? path.substring(path.lastIndexOf('.') + 1) : path; String key = path.substring(path.lastIndexOf('.') + 1);
if (StringUtils.isNumeric(key)) {
int pos = path.length();
for (int i = 0; i < 2; i++) {
pos = path.lastIndexOf('.', pos - 1);
}
key = path.substring(pos + 1);
}
map.put(key, json); map.put(key, json);
} }
} }