All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.fastjson.serializer.ListSerializer Maven / Gradle / Ivy

Go to download

Fastjson is a JSON processor (JSON parser + JSON generator) written in Java

There is a newer version: 2.0.53
Show newest version
package com.alibaba.fastjson.serializer;

import com.alibaba.fastjson2.JSONWriter;

import java.io.IOException;
import java.lang.reflect.Type;
import java.util.List;

public class ListSerializer
        implements ObjectSerializer {
    public static final ListSerializer instance = new ListSerializer();

    private ListSerializer() {
    }

    public final void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features)
            throws IOException {
        JSONWriter out = serializer.out.raw;

        if (object == null) {
            out.writeArrayNull();
            return;
        }

        List list = (List) object;
        out.write(list);
    }

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
        JSONWriter out = serializer.out.raw;

        if (object == null) {
            out.writeArrayNull();
            return;
        }

        List list = (List) object;
        out.write(list);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy