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

src.java.test.TestGenerator Maven / Gradle / Ivy

package test;

import java.io.*;
import java.math.BigDecimal;

import org.codehaus.jackson.*;

public class TestGenerator
{
    private TestGenerator() { }

    public static void main(String[] args)
        throws Exception
    {
        StringWriter strw = new StringWriter();
        JsonGenerator jg = new JsonFactory().createJsonGenerator(strw);

        jg.writeStartObject();
        jg.writeFieldName("pi");
        //jg.writeNumber(new BigDecimal("1.23"));
        jg.writeNumber(new BigDecimal("1.23"));
        jg.writeEndObject();

        jg.close();

        System.out.println("Result: <"+strw.toString()+">");
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy