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;
}