Create a Formatter object having the specified stream, usePrettyStyle, initialIndentLevel, spacesPerLevel, escapeForwardSlash, and basicAllocator attributes.

Synopsis

Declared in <baljsn_formatter.h>

Formatter(
    std::ostream& stream,
    bool usePrettyStyle,
    int initialIndentLevel,
    int spacesPerLevel,
    bool escapeForwardSlash,
    bslma::Allocator* basicAllocator = 0);

Parameters

Name

Description

stream

output stream for formatted JSON

usePrettyStyle

whether to use pretty encoding style

initialIndentLevel

starting indentation level for pretty style

spacesPerLevel

spaces per indentation level for pretty style

escapeForwardSlash

whether to escape / as /

basicAllocator

memory allocator; null uses the default

Created with MrDocs