String test = "jdkalkjda|||djkdla|||djlak"; String str[] = test.split("\\|\\|\\|"); System.out.println(str.length); HashMap<String,Object> t= new HashMap<String,Object>(); HashMap<String,Object> t1 = new HashMap<String,Object>(); t1.put("k","3"); Object s1 = JSONObject.toJSON(t1); t.put("key",s1); String s = JSONObject.toJSONString(t); System.out.println(s); String s2 = JSONObject.parSEObject(s).getJSONObject("key").toString(); System.out.println(JSONObject.parSEObject(s2).getDouble("k")); System.out.println(JSONObject.parSEObject(s).getJSONObject("key").getDouble("k"));