Search in sources :

Example 11 with ListSerializer

use of com.alibaba.fastjson.serializer.ListSerializer in project fastjson by alibaba.

the class ListSerializerTest method test_6_s.

public void test_6_s() throws Exception {
    SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
    ListSerializer listSerializer = new ListSerializer();
    List<Object> list = new ArrayList<Object>();
    list.add(1L);
    list.add(1453964515792017682L);
    listSerializer.write(new JSONSerializer(out), list, null, null, 0);
    Assert.assertEquals("[1,\"1453964515792017682\"]", out.toString());
}
Also used : ListSerializer(com.alibaba.fastjson.serializer.ListSerializer) SerializeWriter(com.alibaba.fastjson.serializer.SerializeWriter) ArrayList(java.util.ArrayList) JSONSerializer(com.alibaba.fastjson.serializer.JSONSerializer)

Aggregations

JSONSerializer (com.alibaba.fastjson.serializer.JSONSerializer)11 ListSerializer (com.alibaba.fastjson.serializer.ListSerializer)11 SerializeWriter (com.alibaba.fastjson.serializer.SerializeWriter)11 ArrayList (java.util.ArrayList)8 LinkedList (java.util.LinkedList)1