Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
v8::JSON Class Reference

#include <v8-json.h>

Static Public Member Functions

static MaybeLocal< ValueParse (Local< Context > context, Local< String > json_string, std::optional< ScriptOriginOptions > origin_options=std::nullopt)
 
static MaybeLocal< StringStringify (Local< Context > context, Local< Value > json_object, Local< String > gap=Local< String >())
 

Detailed Description

A JSON Parser and Stringifier.

Member Function Documentation

◆ Parse()

static MaybeLocal< Value > v8::JSON::Parse ( Local< Context context,
Local< String json_string,
std::optional< ScriptOriginOptions origin_options = std::nullopt 
)
static

Tries to parse the string |json_string| and returns it as value if successful.

Parameters
thecontext in which to parse and create the value.
json_stringThe string to parse.
origin_optionsOptional script origin options to use for error reporting. If not provided, error reporting will use default origin options or attempt to infer origin from the current stack.
Returns
The corresponding value if successfully parsed.

◆ Stringify()

static MaybeLocal< String > v8::JSON::Stringify ( Local< Context context,
Local< Value json_object,
Local< String gap = LocalString >() 
)
static

Tries to stringify the JSON-serializable object |json_object| and returns it as string if successful.

Parameters
json_objectThe JSON-serializable object to stringify.
Returns
The corresponding string if successfully stringified.

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