嗨,我有这个String
,其中包含List of 2 strings
。然后,这些2 strings
包含2 maps
。
示例def listStr = '["{"isReal":true,"area":"a"}","{"isRefundable":false,"area":"b"}"]'
;
如何从2张地图的字符串列表中获取?
结果[{isReal=true},{isRefundable=false}]
答案 0 :(得分:0)
RecurringJobManager
可以为您完成这项工作:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IRecurringJobManager recurringJobs)
{
//Access To HangFire dashboard : http://app_hostname/hangfire
app.UseHangfireDashboard();
app.UseHangfireServer();
//....
//....
app.UseMvc();
//....
//....
recurringJobs.AddOrUpdate("FixOrderJob", Job.FromExpression<IOrderFixerService>(x => x.FixLatestUnknownOrder()), Cron.MinuteInterval(1));
}
如果要在输出中包含地图,则可以像这样转换JsonSlurper
:
import groovy.json.JsonSlurper
JsonSlurper js = new JsonSlurper()
def listStr = '["{"isReal":true}","{"isRefundable":false}"]'
def res = []
listStr.eachMatch( /"(\{[^\{\}]+\})"/ ){ res << js.parseText( it[ 1 ] ) }
assert [[isReal:true], [isRefundable:false]] == res