forceAsList function
will force an entry which may come es a string into a list if it is not already. @hint this is an inplace operation!
Implementation
forceAsList(Json json, SimpleJsonPath path) {
if (path.isEmpty) {
throw JsonPathException('Path must not be empty', code: 2349888823);
}
var value = getByPath(json, path);
var parent = getByPath(json, path.sublist(0, path.length - 1));
var key = path.last;
if (value.runtimeType != List) {
parent[key] = [value];
}
return value;
}