一、将List String转为 List Map
def ori = ["https://ea2518240ecba.jpg","https://a071c1bc4a228ea9o.jpg","https://2fbfd7777f1c8.jpg","https://f240d6ce832a4.jpg"]
def map = [];
for (int i=0; i<ori.size(); i++){
def res = [:];
res.put("imgUrl", ori[i]);
map.add(res);
}
return map
二、将String转为List
def ids = "[10, 1, 9]"
def l = Eval.me(ids)
/*
def ids = "[9,10,2]"
ids = Eval.me(ids);
def map = [];
for(int i=0; i<ids.size(); i++){
map.add(ids[i]);
}
return map
//结果:[9,10,2]
*/