Forward declaration of folly::dynamic used for serializing results.

Synopsis

Declared in <folly/json/dynamic.h>

struct dynamic;

Types

Name

Description

NumericTypeHelper

Trait mapping an arithmetic type to the dynamic member it is stored as.

array_range_construct_t

Used with the array‐range ctor.

const_item_iterator

Const iterator over the key‐value items of an object.

const_key_iterator

Const iterator over the keys of an object.

const_value_iterator

Const iterator over the values of an object.

item_iterator

Mutable iterator over the key‐value items of an object.

json_pointer_resolution_error

Error describing why a JSON pointer failed to resolve.

json_pointer_resolved_value

A value located by resolving a JSON pointer, with its parent context.

value_iterator

Mutable iterator over the values of an object.

Type Aliases

Name

Description

const_iterator

Const iterator over array elements.

iterator

Mutable iterator over array elements.

resolved_json_pointer

The result of resolving a JSON pointer: either the resolved value or a resolution error.

value_type

The element type held by a dynamic array.

Enums

Name

Description

Type

The set of types a dynamic can hold.

json_pointer_resolution_error_code

Reason a JSON pointer failed to resolve against a dynamic.

Member Functions

Name

Description

dynamic [constructor]

Constructors

~dynamic [destructor]

Destroys the dynamic and any value it holds.

operator=

Assignment operators

asBool

Type conversion.

asDouble

Type conversion.

asInt

Type conversion.

asString

Type conversion.

at

Access sub‐field or index.

back

Return reference to the last element in an array.

begin

Array iteration.

c_str

c_str overloads

contains

Check if key exists.

count

Count by key.

emplace

Overwriting emplacement.

empty

Tests for emptiness.

end

Array iteration.

erase

erase overloads

eraseInto

Erase one object item and move its key and value into a callback.

find

find overloads

getBool

getString overloads

getDefault

getDefault overloads

getDouble

getString overloads

getInt

getString overloads

getString

getString overloads

get_ptr

get_ptr overloads

hash

Hash self.

insert

insert overloads

isArray

Type test.

isBool

Type test.

isDouble

Type test.

isInt

Type test.

isNull

Type test.

isNumber

Type test.

isObject

Type test.

isString

Type test.

items

Get key‐value items of an object.

keys

Get the keys of an object.

merge_patch

Merge JSON Patch.

operator%=

Assigns the remainder of dividing this dynamic by another. methodset Op

operator&=

Bitwise‐ANDs another dynamic into this one. methodset Op

operator*=

Multiplies this dynamic by another. methodset Op

operator++

Increment operators

operator+=

Adds another dynamic into this one. methodset Op

operator‐‐

Decrement operators

operator‐=

Subtracts another dynamic from this one. methodset Op

operator/=

Divides this dynamic by another. methodset Op

operator[]

Subscript operators

operatorˆ=

Bitwise‐XORs another dynamic into this one. methodset Op

operator|=

Bitwise‐ORs another dynamic into this one. methodset Op

pop_back

Remove an element from the back of an array.

push_back

push_back overloads

reserve

Pre‐allocate size.

resize

Change size.

setDefault

setDefault overloads

size

Get size.

stringPiece

c_str overloads

try_emplace

Non‐overwriting emplacement.

try_get_ptr

try_get_ptr overloads

type

The type of this dynamic.

typeName

The type of this dynamic as a printable string.

update

Merge objects.

update_missing

Extends this object with mergeObj1, keeping this object's value on duplicate keys.

values

Get the values of an object.

Static Member Functions

Name

Description

array

array overloads

array_range

array_range overloads

merge

Creates a new object with the key/value pairs of both objects, preferring the second object's value on duplicate keys.

merge_diff

Compute patch.

object

object overloads

Static Data Members

Name

Description

array_range_construct

Tag value selecting the array‐range constructor.

Friends

Name

Description

folly::TypeError

Exception thrown when a dynamic is accessed as the wrong type.

folly::dynamic_view

A mutable view of a dynamic that can extract values without copying.

folly::const_dynamic_view

///////////////////////////////////////////////////////////////////

folly::operator<<

Streams a dynamic to an output stream.

folly::operator+

Adds two dynamics, reusing the left‐hand operand's storage.

folly::operatorˆ

Bitwise‐XORs two dynamics.

folly::operator&

Bitwise‐ANDs two dynamics.

folly::operator|

Bitwise‐ORs two dynamics.

folly::operator%

Computes the remainder of dividing two dynamics.

folly::operator/

Divides two dynamics.

folly::operator*

Multiplies two dynamics.

folly::operator‐

Subtracts two dynamics.

folly::operator+

Adds two dynamics.

folly::operator>=

Greater‐than‐or‐equal comparison.

folly::operator<=

Less‐than‐or‐equal comparison.

folly::operator>

Greater‐than comparison.

folly::operator<

Orders two dynamics.

folly::operator!=

Deep inequality comparison.

folly::operator==

Deep equality comparison. This will compare all the way down an object or array, and is potentially expensive.

Non-Member Functions

Name

Description

PrintTo

Printer for GTest.

benchmarkResultsFromDynamic

Deserialize benchmark results from a dynamic value.

compareDynamicWithNestedJson

Like compareJson, but with dynamic instances.

compareDynamicWithTolerance

Like compareJsonWithTolerance, but operates directly on the dynamics.

convertTo

Return a well‐typed representation of a dynamic.

erase

Like erase(vector), since C++20.

erase_if

Like erase_if(vector), erase_if(unordered_map), since C++20.

logConfigToDynamic

Convert a LogHandlerConfig object to a folly::dynamic object.

logConfigToDynamic

Convert a LogConfig object to a folly::dynamic object.

logConfigToDynamic

Convert a LogCategoryConfig object to a folly::dynamic object.

make_dynamic_view

Deleted to prevent viewing a temporary dynamic.

make_dynamic_view

Returns a contextually‐correct view for the given dynamic.

make_dynamic_view

Returns a contextually‐correct view for the given dynamic.

parseJson

Parse a json blob out of a range and produce a dynamic representing it.

parseJson

Parse a json blob out of a range and produce a dynamic representing it.

parseJson5

Parse an experimental json5 blob and produce a dynamic representing it.

parseJsonWithMetadata

Parse a json blob, recording parse metadata for each value.

parseJsonWithMetadata

Parse a json blob with options, recording parse metadata for each value.

parseLogConfigDynamic

Parse a folly::dynamic object.

toDynamic

Turn an arbitrary type into a dynamic.

toJson

Serialize a dynamic into a json string.

toPrettyJson

Serialize a dynamic into a json string with indentation. Note that the keys of all objects will be sorted.

bser::parseBser

Parse a BSER value from a string with deserialization options.

bser::parseBser

Parse a BSER value from an IOBuf with deserialization options.

bser::parseBser

Parse a BSER value from an IOBuf.

bser::parseBser

Parse a BSER value from a byte range with deserialization options.

bser::parseBser

Parse a BSER value from a string.

bser::parseBser

Parse a BSER value from a byte range.

bser::toBser

Serialize a dynamic value to a BSER‐encoded string.

bser::toBserIOBuf

Serialize a dynamic value to a BSER‐encoded IOBuf.

json::serialize

Serialize dynamic to json‐string, with options.

jsonschema::makeValidator

Make a validator that can be used to check various json. Thread‐safe.

Created with MrDocs