pjson 2.0.0
A small, owning JSON value for C++11
Loading...
Searching...
No Matches
ByteDance::pjson::SerializeOptions Struct Reference

Controls JSON serialization. More...

#include <pjson.h>

Public Types

enum  NonFinitePolicy { RejectNonFinite , NonFiniteToNull , NonFiniteToString }
 Selects how stored NaN and infinity values are represented. More...
 

Public Member Functions

 SerializeOptions ()
 Selects compact output, two-space indentation, and non-finite rejection.
 

Static Public Member Functions

static SerializeOptions prettyPrinted ()
 Returns the defaults with pretty printing enabled.
 

Public Attributes

bool pretty
 Enables line breaks and indentation.
 
size_t indentWidth
 Indentation characters per nesting level.
 
char indentCharacter
 Space or tab; invalid values are treated as space.
 
bool escapeNonAscii
 Emits non-ASCII code points as Unicode escapes.
 
NonFinitePolicy nonFinite
 Policy for NaN and infinity values.
 
size_t maxOutputBytes
 Output ceiling; zero explicitly means unlimited.
 

Detailed Description

Controls JSON serialization.

The default produces compact output in native object-storage order. Pretty output places each array element/object member on its own line. Only space and tab are valid indentation characters; any other value is treated as a space so serialization always remains valid JSON.

Object storage and serialization order are unspecified.

Definition at line 216 of file pjson.h.

Member Enumeration Documentation

◆ NonFinitePolicy

Selects how stored NaN and infinity values are represented.

Enumerator
RejectNonFinite 

Fail because JSON has no non-finite number literal.

NonFiniteToNull 

Emit non-finite values as JSON null.

NonFiniteToString 

Emit "NaN" or signed "Infinity" strings.

Definition at line 226 of file pjson.h.

Constructor & Destructor Documentation

◆ SerializeOptions()

ByteDance::pjson::SerializeOptions::SerializeOptions ( )

Selects compact output, two-space indentation, and non-finite rejection.

Member Function Documentation

◆ prettyPrinted()

static SerializeOptions ByteDance::pjson::SerializeOptions::prettyPrinted ( )
static

Returns the defaults with pretty printing enabled.

Member Data Documentation

◆ escapeNonAscii

bool ByteDance::pjson::SerializeOptions::escapeNonAscii

Emits non-ASCII code points as Unicode escapes.

Definition at line 235 of file pjson.h.

◆ indentCharacter

char ByteDance::pjson::SerializeOptions::indentCharacter

Space or tab; invalid values are treated as space.

Definition at line 234 of file pjson.h.

◆ indentWidth

size_t ByteDance::pjson::SerializeOptions::indentWidth

Indentation characters per nesting level.

Definition at line 233 of file pjson.h.

◆ maxOutputBytes

size_t ByteDance::pjson::SerializeOptions::maxOutputBytes

Output ceiling; zero explicitly means unlimited.

Definition at line 237 of file pjson.h.

◆ nonFinite

NonFinitePolicy ByteDance::pjson::SerializeOptions::nonFinite

Policy for NaN and infinity values.

Definition at line 236 of file pjson.h.

◆ pretty

bool ByteDance::pjson::SerializeOptions::pretty

Enables line breaks and indentation.

Definition at line 232 of file pjson.h.


The documentation for this struct was generated from the following file: