Jackson Glossary: JsonGenerator

Role

This is the main "writer" class of core Jackson package. It offers a high-performance incremental, "streaming" (see JacksonStreamingApi) method for writing JSON content.

Instances are meant to be used from a single thread (they are not thread-safe); and they are not reusable (there are no methods for reset instances -- there are no performance benefits from doing so because reuse of underlying buffers is implemented separate from life-cycle of generator instances) by design.

Usage

Instances are created by JsonFactory, either directly, or through higher-level abstractions like ObjectMapper.

JacksonStreamingApi contains simple examples of usage.

Just like for JsonParser (its reader-side counterpart), there exist multiple non-JSON-producing variants of JsonGenerator. For example, both XmlFactory and SmileFactory offer respective writers that produce data in alternative formats (XML and Smile, respectively).

Most of configuration is by enabling/disabling JsonGenerator.Feature options.


Back to Jackson Term Glossary


CategoryJackson

JsonGenerator (last edited 2011-02-25 22:50:11 by TatuSaloranta)

Copyright ©2009 FasterXML, LLC