BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Types | Static Public Member Functions | List of all members
fc::json Class Reference

#include <json.hpp>

Public Types

enum  parse_type { legacy_parser = 0, broken_nul_parser = 4 }
 
enum  output_formatting { stringify_large_ints_and_doubles = 0, legacy_generator = 1 }
 

Static Public Member Functions

static ostreamto_stream (ostream &out, const std::string &)
 
static ostreamto_stream (ostream &out, const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static ostreamto_stream (ostream &out, const variants &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static ostreamto_stream (ostream &out, const variant_object &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_stream (buffered_istream &in, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_string (const string &utf8_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variants variants_from_string (const string &utf8_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static string to_string (const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static string to_pretty_string (const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static bool is_valid (const std::string &json_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static void save_to_file (const T &v, const fc::path &fi, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static void save_to_file (const variant &v, const fc::path &fi, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_file (const fc::path &p, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static T from_file (const fc::path &p, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static string to_string (const T &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static string to_pretty_string (const T &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static void save_to_file (const T &v, const std::string &p, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 

Detailed Description

Provides interface for json serialization.

json strings are always UTF8

Definition at line 17 of file json.hpp.

Member Enumeration Documentation

◆ output_formatting

Enumerator
stringify_large_ints_and_doubles 
legacy_generator 

Definition at line 30 of file json.hpp.

◆ parse_type

Enumerator
legacy_parser 
broken_nul_parser 

Definition at line 20 of file json.hpp.

Member Function Documentation

◆ from_file() [1/2]

variant fc::json::from_file ( const fc::path p,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 767 of file json.cpp.

◆ from_file() [2/2]

template<typename T >
static T fc::json::from_file ( const fc::path p,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 60 of file json.hpp.

◆ from_stream()

variant fc::json::from_stream ( buffered_istream in,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 773 of file json.cpp.

◆ from_string()

variant fc::json::from_string ( const string &  utf8_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 458 of file json.cpp.

◆ is_valid()

bool fc::json::is_valid ( const std::string &  json_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 810 of file json.cpp.

◆ save_to_file() [1/3]

template<typename T >
static void fc::json::save_to_file ( const T &  v,
const fc::path fi,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 51 of file json.hpp.

◆ save_to_file() [2/3]

template<typename T >
static void fc::json::save_to_file ( const T &  v,
const std::string &  p,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 78 of file json.hpp.

◆ save_to_file() [3/3]

void fc::json::save_to_file ( const variant v,
const fc::path fi,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 753 of file json.cpp.

◆ to_pretty_string() [1/2]

template<typename T >
static string fc::json::to_pretty_string ( const T &  v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 72 of file json.hpp.

◆ to_pretty_string() [2/2]

std::string fc::json::to_pretty_string ( const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 748 of file json.cpp.

◆ to_stream() [1/4]

ostream & fc::json::to_stream ( ostream out,
const std::string &  str 
)
static

Definition at line 562 of file json.cpp.

◆ to_stream() [2/4]

ostream & fc::json::to_stream ( ostream out,
const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 794 of file json.cpp.

◆ to_stream() [3/4]

ostream & fc::json::to_stream ( ostream out,
const variant_object v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 804 of file json.cpp.

◆ to_stream() [4/4]

ostream & fc::json::to_stream ( ostream out,
const variants v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 799 of file json.cpp.

◆ to_string() [1/2]

template<typename T >
static string fc::json::to_string ( const T &  v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 66 of file json.hpp.

◆ to_string() [2/2]

std::string fc::json::to_string ( const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 650 of file json.cpp.

◆ variants_from_string()

variants fc::json::variants_from_string ( const string &  utf8_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 465 of file json.cpp.


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