Open Lighting Architecture  Latest Git
Files | Namespaces | Classes | Functions
JSON

Detailed Description

JSON based APIs.

The ola::web namespace provides:

Serialization Example
\#include <ola/web/Json.h>
\#include <ola/web/JsonWriter.h>
JsonObject obj;
obj.Add("name", "simon");
obj.Add("age", 10);
obj.Add("male", true);
JsonArray *friends = obj.AddArray("friends");
friends->Add("Peter");
friends->Add("Bob");
friends->Add("Jane");
const std::string output = JsonWriter::AsString(json);
Parsing Example
\#include <ola/web/Json.h>
\#include <ola/web/JsonParser.h>
std::string error;
JsonValue *value = JsonParser::Parse(json_string, &error);
Collaboration diagram for JSON:

Files

file  Json.h
 Basic data types used to represent elements in a JSON document.
 
file  JsonData.h
 The top level container for JSON data.
 
file  JsonLexer.h
 The class used to parse JSON data.
 
file  JsonParser.h
 A JsonParserInterface implementation that builds a parse tree.
 
file  JsonPatch.h
 Implementation of JSON Patch (RFC 6902).
 
file  JsonPatchParser.h
 Create a JsonPatchSet from a string.
 
file  JsonPointer.h
 An implementation of Json Pointers (RFC 6901).
 
file  JsonSchema.h
 A Json Schema, see www.json-schema.org.
 
file  JsonTypes.h
 Enums used to identfy JSON types.
 
file  JsonWriter.h
 Serialize JSON data.
 

Namespaces

 ola
 The namespace containing all OLA symbols.
 

Classes

class  ola::web::JsonValueVisitorInterface
 The interface for the JsonValueVisitor class. More...
 
class  ola::web::JsonValueConstVisitorInterface
 The const interface for the JsonValueVisitor class. More...
 
class  ola::web::JsonValue
 The base class for JSON values. More...
 
class  ola::web::JsonLeafValue
 A base class used to describe values which are leafs of a JSON tree. More...
 
class  ola::web::JsonString
 A string value. More...
 
class  ola::web::JsonNumber
 JsonNumber is the base class for various integer / number classes. More...
 
class  ola::web::JsonUInt
 An unsigned 32bit int value. More...
 
class  ola::web::JsonInt
 A signed 32bit int value. More...
 
class  ola::web::JsonUInt64
 An unsigned 64bit int value. More...
 
class  ola::web::JsonInt64
 A signed 64bit int value. More...
 
class  ola::web::JsonDouble
 A double value. More...
 
class  ola::web::JsonBool
 A Bool value. More...
 
class  ola::web::JsonNull
 The null value. More...
 
class  ola::web::JsonRawValue
 A raw value, useful if you want to cheat. More...
 
class  ola::web::JsonObject
 A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python. More...
 
class  ola::web::JsonArray
 An array of JSON values. Arrays in JSON can contain values of different types. More...
 
class  ola::web::JsonObjectPropertyVisitor
 A class used to visit Json values within a JsonObject. More...
 
class  ola::web::JsonData
 Represents a JSON text as defined in section 2 of RFC7158. More...
 
class  ola::web::JsonLexer
 Parse a string containing Json data. More...
 
class  ola::web::JsonParserInterface
 The interface used to handle tokens during JSON parsing. More...
 
class  ola::web::JsonParser
 A JsonParserInterface implementation that builds a tree of JsonValues. More...
 
class  ola::web::JsonPatchOp
 A class to serialize a JSONValue to text. More...
 
class  ola::web::JsonPatchAddOp
 Add a JsonValue. More...
 
class  ola::web::JsonPatchRemoveOp
 Remove the value at the specified path. More...
 
class  ola::web::JsonPatchReplaceOp
 Replace the value at the specified path. More...
 
class  ola::web::JsonPatchMoveOp
 Move a value from one location to another. More...
 
class  ola::web::JsonPatchCopyOp
 Copy a value from one location to another. More...
 
class  ola::web::JsonPatchTestOp
 Test a path matches the specified value. More...
 
class  ola::web::JsonPatchSet
 An ordered collection of JsonPatchOps. More...
 
class  ola::web::JsonPatchParser
 Parse a JSON Patch document (RFC 6902). More...
 
class  ola::web::ValidatorInterface
 The interface Json Schema Validators. More...
 
class  ola::web::BaseValidator
 The base class for Json BaseValidators. All Visit methods return false. More...
 
class  ola::web::WildcardValidator
 The wildcard validator matches everything. This corresponds to the empty schema, i.e. {}. More...
 
class  ola::web::ReferenceValidator
 A reference validator holds a pointer to another schema. More...
 
class  ola::web::StringValidator
 The validator for JsonString. More...
 
class  ola::web::BoolValidator
 The validator for JsonBool. More...
 
class  ola::web::NullValidator
 The validator for JsonNull. More...
 
class  ola::web::NumberConstraint
 The base class for constraints that can be applies to the Json number type. More...
 
class  ola::web::MultipleOfConstraint
 Confirms the valid is a multiple of the specified value. More...
 
class  ola::web::MaximumConstraint
 Enforces a maximum. More...
 
class  ola::web::MinimumConstraint
 Enforces a minimum. More...
 
class  ola::web::IntegerValidator
 The validator for Json integers. More...
 
class  ola::web::NumberValidator
 The validator for Json numbers. More...
 
class  ola::web::ObjectValidator
 The validator for JsonObject. More...
 
class  ola::web::ArrayValidator
 The validator for JsonArray. More...
 
class  ola::web::ConjunctionValidator
 The base class for validators that operate with a list of child validators (allOf, anyOf, oneOf). More...
 
class  ola::web::AllOfValidator
 A validator which ensures all child validators pass (allOf). More...
 
class  ola::web::AnyOfValidator
 A validator which ensures at least one of the child validators pass (anyOf). More...
 
class  ola::web::OneOfValidator
 A validator which ensures at only one of the child validators pass (oneOf). More...
 
class  ola::web::NotValidator
 A validator that inverts the result of the child (not). More...
 
class  ola::web::SchemaDefinitions
 
class  ola::web::JsonSchema
 A JsonHandlerInterface implementation that builds a parse tree. More...
 
class  ola::web::JsonWriter
 A class to serialize a JSONValue to text. More...
 

Functions

JsonObjectola::web::ObjectCast (JsonValue *value)
 Downcast a JsonValue to a JsonObject. More...
 
JsonArrayola::web::ArrayCast (JsonValue *value)
 Downcast a JsonValue to a JsonArray. More...
 

Function Documentation

◆ ArrayCast()

JsonArray * ola::web::ArrayCast ( JsonValue value)

Downcast a JsonValue to a JsonArray.

This should be used rather than dynamic_cast<JsonArray> since it doesn't rely on RTTI.

◆ ObjectCast()

JsonObject * ola::web::ObjectCast ( JsonValue value)

Downcast a JsonValue to a JsonObject.

This should be used rather than dynamic_cast<JsonObject> since it doesn't rely on RTTI.