JSONObject jobj = JSONObject.fromObject(conditions == null ? "{}"
: conditions);
Iterator it = jobj.keys();
String infotype = "FCCS";
while (it.hasNext()) {
String key = it.next().toString();
// 将所有的空串去掉
if (StringUtil.getString(jobj.getString(key)) == null) {
continue;
}
if("infoType".equals(key)){ //试剂类型
if("FCCS".equals(jobj.getString(key))){
infotype = "FCCS";
}else if("HS".equals(jobj.getString(key))){
infotype = "HS";
}
}
/**
* @Title: JsonStrTrim
* @author : jsw
* @date : 2012-12-7
* @time : 上午09:19:18
* @Description: 传入string 类型的 json字符串 去处字符串中的属性值的空格
* @param jsonStr
* @return
* @exception:(异常说明)
*/
public JSONObject JsonStrTrim(String jsonStr){
JSONObject reagobj = JSONObject.fromObject(jsonStr);
// 取出 jsonObject 中的字段的值的空格
Iterator itt = reagobj.keys();
while (itt.hasNext()) {
String key = itt.next().toString();
String value = reagobj.getString(key);
if(value == null){
continue ;
}else if("".equals(value.trim())){
continue ;
}else{
reagobj.put(key, value.trim());
}
}
return reagobj;
}
/**
* @Title: JsonStrTrim
* @author : jsw
* @date : 2012-12-7
* @time : 上午09:21:48
* @Description: 传入jsonObject 去除当中的空格
* @param jsonStr
* @return
* @exception:(异常说明)
*/
public JSONObject JsonStrTrim(JSONObject jsonStr){
JSONObject reagobj = jsonStr ;
// 取出 jsonObject 中的字段的值的空格
Iterator itt = reagobj.keys();
while (itt.hasNext()) {
String key = itt.next().toString();
String value = reagobj.getString(key);
if(value == null){
continue ;
}else if("".equals(value.trim())){
continue ;
}else{
reagobj.put(key, value.trim());
}
}
return reagobj;
}
/**
* @Title: JsonStrTrim
* @author : jsw
* @date : 2012-12-7
* @time : 上午11:48:59
* @Description: 将 jsonarry 的jsonObject 中的value值去处前后空格
* @param arr
* @return
* @exception:(异常说明)
*/
public JSONArray JsonStrTrim(JSONArray arr){
if( arr != null && arr.size() > 0){
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = (JSONObject) arr.get(i);
// 取出 jsonObject 中的字段的值的空格
Iterator itt = obj.keys();
while (itt.hasNext()) {
String key = itt.next().toString();
String value = obj.getString(key);
if(value == null){
continue ;
}else if("".equals(value.trim())){
continue ;
}else{
obj.put(key, value.trim());
}
}
arr.set(i, obj );
}
}
return arr;
}