Search in sources :

Example 91 with JSONObject

use of com.alibaba.fastjson.JSONObject in project fastjson by alibaba.

the class Issue87 method test_for_issue.

public void test_for_issue() throws Exception {
    TestObject to = new TestObject();
    to.add("test1");
    to.add("test2");
    String text = JSON.toJSONString(to);
    System.out.println(text);
    JSONObject jo = JSON.parseObject(text);
    to = JSON.toJavaObject(jo, TestObject.class);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 92 with JSONObject

use of com.alibaba.fastjson.JSONObject in project fastjson by alibaba.

the class Issue87_hashset method test_for_issue.

public void test_for_issue() throws Exception {
    TestObject to = new TestObject();
    to.add("test1");
    to.add("test2");
    String text = JSON.toJSONString(to);
    System.out.println(text);
    JSONObject jo = JSON.parseObject(text);
    to = JSON.toJavaObject(jo, TestObject.class);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 93 with JSONObject

use of com.alibaba.fastjson.JSONObject in project fastjson by alibaba.

the class Issue94 method test_for_issue.

public void test_for_issue() throws Exception {
    JSONObject o = new JSONObject();
    o.put("line", "{\"1\":€}");
    o.toString();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 94 with JSONObject

use of com.alibaba.fastjson.JSONObject in project fastjson by alibaba.

the class Issue780 method test_for_issue.

public void test_for_issue() throws Exception {
    JSONObject json = new JSONObject();
    json.put("robj", "{abc: 123}");
    JSONObject robj = json.getJSONObject("robj");
    assertEquals(123, robj.get("abc"));
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 95 with JSONObject

use of com.alibaba.fastjson.JSONObject in project fastjson by alibaba.

the class Issue793 method test_for_issue.

public void test_for_issue() throws Exception {
    String text = "{ \"code\": 1000, \"data\": \"success\", \"game_data\": [], \"member_list\": [], \"message\": \"\\u6210\\u529f\" }";
    JSONObject json = JSON.parseObject(text);
    assertEquals(1000, json.get("code"));
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)374 JSONArray (com.alibaba.fastjson.JSONArray)37 Test (org.junit.Test)32 DefaultJSONParser (com.alibaba.fastjson.parser.DefaultJSONParser)23 HashMap (java.util.HashMap)20 JSONException (com.alibaba.fastjson.JSONException)18 ArrayList (java.util.ArrayList)18 Date (java.util.Date)18 JSONReaderScanner (com.alibaba.fastjson.parser.JSONReaderScanner)14 IOException (java.io.IOException)12 Map (java.util.Map)12 WXSDKInstanceTest (com.taobao.weex.WXSDKInstanceTest)11 JSMethod (com.taobao.weex.annotation.JSMethod)11 WXBridgeManagerTest (com.taobao.weex.bridge.WXBridgeManagerTest)9 BigDecimal (java.math.BigDecimal)9 List (java.util.List)9 ValueStack (com.roof.chain.api.ValueStack)7 GenericValueStack (com.roof.chain.support.GenericValueStack)7 Gson (com.google.gson.Gson)6 BigInteger (java.math.BigInteger)5