Search in sources :

Example 36 with JSONReaderScanner

use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.

the class JSONReaderScannerTest_type method test_true.

@SuppressWarnings("rawtypes")
public void test_true() throws Exception {
    DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"@type\":\"java.util.LinkedHashMap\",\"name\":\"张三\"}"));
    LinkedHashMap json = (LinkedHashMap) parser.parse();
    Assert.assertEquals("张三", json.get("name"));
    parser.close();
}
Also used : JSONReaderScanner(com.alibaba.fastjson.parser.JSONReaderScanner) DefaultJSONParser(com.alibaba.fastjson.parser.DefaultJSONParser) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

JSONReaderScanner (com.alibaba.fastjson.parser.JSONReaderScanner)36 DefaultJSONParser (com.alibaba.fastjson.parser.DefaultJSONParser)35 JSONObject (com.alibaba.fastjson.JSONObject)14 Reader (java.io.Reader)14 StringReader (java.io.StringReader)14 JSONArray (com.alibaba.fastjson.JSONArray)5 BigDecimal (java.math.BigDecimal)3 SimpleDateFormat (java.text.SimpleDateFormat)1 LinkedHashMap (java.util.LinkedHashMap)1