JsonCpp - JSON data format manipulation library

JsonCpp project page | JsonCpp home page

Public Member Functions | List of all members
Json::FastWriter Class Reference

Outputs a Value in JSON format without formatting (not human friendly). More...

`#include <json/writer.h>`

Inheritance diagram for Json::FastWriter:
Collaboration diagram for Json::FastWriter:

## Public Member Functions
| FastWriter ()
| ~FastWriter ()
void | enableYAMLCompatibility ()
void | dropNullPlaceholders ()
| Drop the "null" string from the writer's output for nullValues. More...
void | omitEndingLineFeed ()
std::string | write (const Value &root)
Public Member Functions inherited from Json::Writer
virtual | ~Writer ()

## Detailed Description

Outputs a Value in JSON format without formatting (not human friendly).

The JSON document is written in a single line. It is not intended for 'human' consumption, but may be usefull to support feature such as RPC where bandwith is limited.

See also
  Reader, Value

Deprecated:
  Use StreamWriterBuilder.

Definition at line 159 of file writer.h.

## Constructor & Destructor Documentation

## § FastWriter()

Json::FastWriter::FastWriter | ( |  | ) |

Definition at line 327 of file json_writer.cpp.

## § ~FastWriter()

Json::FastWriter::~FastWriter | ( |  | ) |
| inline

Definition at line 163 of file writer.h.

References JSONCPP_OVERRIDE, and JSONCPP_STRING.

## Member Function Documentation

## § dropNullPlaceholders()

void Json::FastWriter::dropNullPlaceholders | ( |  | ) |

Drop the "null" string from the writer's output for nullValues.

Strictly speaking, this is not valid JSON. But when the output is being fed to a browser's Javascript, it makes for smaller output and the browser can handle the output just fine.

Definition at line 333 of file json_writer.cpp.

## § enableYAMLCompatibility()

void Json::FastWriter::enableYAMLCompatibility | ( |  | ) |

Definition at line 331 of file json_writer.cpp.

## § omitEndingLineFeed()

void Json::FastWriter::omitEndingLineFeed | ( |  | ) |

Definition at line 335 of file json_writer.cpp.

## § write()

std::string Json::FastWriter::write | ( | const Value & | root | ) |
| virtual

Implements Json::Writer.

Definition at line 337 of file json_writer.cpp.

References Json::arrayValue, Json::Value::asBool(), Json::Value::asDouble(), Json::Value::asLargestInt(), Json::Value::asLargestUInt(), Json::booleanValue, Json::Value::getMemberNames(), Json::Value::getString(), Json::intValue, JSONCPP_STRING, Json::nullValue, Json::objectValue, Json::realValue, Json::Value::size(), Json::stringValue, Json::Value::type(), Json::uintValue, Json::valueToQuotedStringN(), and Json::valueToString().

The documentation for this class was generated from the following files:

- include/json/writer.h
- src/lib_json/json_writer.cpp