CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Typedefs | Enumerations | Functions
cppcms::json Namespace Reference

This namespace includes all JSON parsing and formatting related classes and functions. More...

## Classes
class | bad_value_cast
| The error that is thrown in case of bad conversion of json::value to ordinary value. More...
struct | null
| Special object that is convertible to null json value. More...
struct | traits
| The type traits schema for converting json values to/from orinary objects i.e. serialization from JSON to C++ object. More...
struct | undefined
| Special object that is convertible to undefined json value. More...
class | value
| This class is central representation of json objects. More...

## Typedefs
typedef std::vector< value > | array
| The json::array - std::vector of json::value's.
typedef std::map< string_key, value > | object
| The json::object - std::map of json::value's.

## Enumerations
enum | json_type { is_undefined, is_null, is_boolean, is_number, is_string, is_object, is_array }
enum | { compact = 0, readable = 1 }

## Functions
bool | operator== (undefined const &, undefined const &)
bool | operator!= (undefined const &, undefined const &)
bool | operator== (null const &, null const &)
bool | operator!= (null const &, null const &)
std::istream CPPCMS_API & | operator>> (std::istream &in, value &v)
std::ostream CPPCMS_API & | operator<< (std::ostream &out, value const &v)
std::ostream CPPCMS_API & | operator<< (std::ostream &out, json_type)
std::string CPPCMS_API | to_json (std::string const &utf)
std::string CPPCMS_API | to_json (char const *begin, char const *end)
void CPPCMS_API | to_json (char const *begin, char const *end, std::ostream &out)
void CPPCMS_API | to_json (std::string const &str, std::ostream &out)

## Detailed Description

This namespace includes all JSON parsing and formatting related classes and functions.

## Enumeration Type Documentation

anonymous enum

Enumerator
compact | Print JSON values in most compact format.
readable | Print JSON values in human readable format (with identention)

enum cppcms::json::json_type

The type of json value

Enumerator
is_undefined | Undefined value.
is_null | null value
is_boolean | boolean value
is_number | numeric value
is_string | string value
is_object | object value
is_array | array value

## Function Documentation

std::ostream CPPCMS_API& cppcms::json::operator<< | ( | std::ostream & | out,
|  | value const & | v
| ) |  |

Write json object to output stream

std::ostream CPPCMS_API& cppcms::json::operator<< | ( | std::ostream & | out,
|  | json_type |
| ) |  |

Write human readable representation of json_type

std::istream CPPCMS_API& cppcms::json::operator>> | ( | std::istream & | in,
|  | value & | v
| ) |  |

Read json object from input stream

std::string CPPCMS_API cppcms::json::to_json | ( | std::string const & | utf | ) |

Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz"

New in CppCMS 1.2

Referenced by cppcms::json::value::swap().

std::string CPPCMS_API cppcms::json::to_json | ( | char const * | begin,
|  | char const * | end
| ) |  |

Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz"

New in CppCMS 1.2

void CPPCMS_API cppcms::json::to_json | ( | char const * | begin,
|  | char const * | end,
|  | std::ostream & | out
| ) |  |

Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz"

New in CppCMS 1.2

void CPPCMS_API cppcms::json::to_json | ( | std::string const & | str,
|  | std::ostream & | out
| ) |  |

Convert UTF-8 string to JSON string, i.e. a sring foo is converted to "foo", a string bar"baz is converted to "bar"baz"

New in CppCMS 1.2