kettle解析json串 |
您所在的位置:网站首页 › kettle41解析json › kettle解析json串 |
import java.util.Iterator; import org.json.simple.JSONObject;import org.json.simple.parser.JSONParser;import org.json.simple.parser.ParseException;public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } if (first){ first = false; } java.text.SimpleDateFormat dateFormator = new java.text.SimpleDateFormat("yyyy-MM-dd"); java.util.regex.Pattern numberPatternor = java.util.regex.Pattern.compile("[0-9]*"); java.util.regex.Pattern datePatternor = java.util.regex.Pattern.compile("[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]"); java.text.SimpleDateFormat ts = new java.text.SimpleDateFormat("yyyy/MM/dd"); java.util.regex.Pattern numberTs = java.util.regex.Pattern.compile("[0-9]*"); r = createOutputRow(r, 1); String jsonContent = get(Fields.In, "jsonContent").getString(r); JSONParser parser = new JSONParser(); JSONObject subObject = new JSONObject(); try { subObject = (JSONObject)parser.parse(jsonContent); } catch (ParseException e) { |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |