TSDuck Version 3.20-1669 (TSDuck - The MPEG Transport Stream Toolkit)
ts::json Namespace Reference

Namespace for JSON (JavaScript Object Notation) classes. More...

Classes

class  Array
 Implementation of a JSON array. More...
 
class  False
 Implementation of a JSON false literal. More...
 
class  Null
 Implementation of a JSON null literal. More...
 
class  Number
 Implementation of a JSON number. More...
 
class  Object
 Implementation of a JSON object. More...
 
class  String
 Implementation of a JSON string. More...
 
class  True
 Implementation of a JSON true literal. More...
 
class  Value
 Abstract base class of a JSON value. More...
 

Typedefs

typedef SafePtr< Value, NullMutexValuePtr
 Smart pointer to a JSON value (not thread-safe).
 

Enumerations

enum  Type {
  TypeNull,
  TypeTrue,
  TypeFalse,
  TypeString,
  TypeNumber,
  TypeObject,
  TypeArray
}
 Definition of the type of a value. More...
 

Functions

bool Parse (ValuePtr &value, const UStringList &lines, Report &report=(*ts::NullReport::Instance()))
 Parse a JSON value (typically an object or array. More...
 
bool Parse (ValuePtr &value, const UString &text, Report &report=(*ts::NullReport::Instance()))
 Parse a JSON value (typically an object or array. More...
 
bool Parse (ValuePtr &value, TextParser &parser, bool jsonOnly, Report &report=(*ts::NullReport::Instance()))
 Parse a JSON value (typically an object or array. More...
 

Variables

const Null NullValue
 A general-purpose constant null JSON value.
 

Detailed Description

Namespace for JSON (JavaScript Object Notation) classes.

Enumeration Type Documentation

◆ Type

Definition of the type of a value.

JSON defines 7 types of value.

Enumerator
TypeNull 

null literal.

TypeTrue 

true literal.

TypeFalse 

false literal.

TypeString 

string value.

TypeNumber 

number value (integer only for now).

TypeObject 

structured object.

TypeArray 

array of values.

Function Documentation

◆ Parse() [1/3]

bool ts::json::Parse ( ValuePtr value,
const UStringList lines,
Report report = (*ts::NullReport::Instance()) 
)

Parse a JSON value (typically an object or array.

Parameters
[out]valueA smart pointer to the parsed JSON value (null on error).
[in]linesList of text lines forming the JSON value.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ Parse() [2/3]

bool ts::json::Parse ( ValuePtr value,
const UString text,
Report report = (*ts::NullReport::Instance()) 
)

Parse a JSON value (typically an object or array.

Parameters
[out]valueA smart pointer to the parsed JSON value (null on error).
[in]textThe text forming the JSON value.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.

◆ Parse() [3/3]

bool ts::json::Parse ( ValuePtr value,
TextParser parser,
bool  jsonOnly,
Report report = (*ts::NullReport::Instance()) 
)

Parse a JSON value (typically an object or array.

Parameters
[out]valueA smart pointer to the parsed JSON value (null on error).
[in,out]parserA text parser.
[in]jsonOnlyIf true, the parsed text shall not contain anything else than the JSON value (except white spaces). If false, on output, the position of the parser is right after the JSON value.
[in,out]reportWhere to report errors.
Returns
True on success, false on error.