From ab7081676adf140cc8967c5ef49641b9a37bae2b Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Mon, 10 Jan 2011 04:25:45 +0100 Subject: Add JSON parser/generator. --- json.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 json.h (limited to 'json.h') diff --git a/json.h b/json.h new file mode 100644 index 0000000..0e18911 --- /dev/null +++ b/json.h @@ -0,0 +1,32 @@ +#ifndef JSON_H +#define JSON_H + +#include +#include +#include +#include + +#include + +namespace JSON { + // TODO: Support null. + typedef boost::make_recursive_variant< + bool, + int, + float, + std::string, + std::vector, + std::map + >::type Value; + + typedef std::vector Array; + typedef std::map Object; + + //! Parse JSON string into value-tree. + bool parse(const std::string& s, Value& v); +}; + +//! Write JSON to stream. +std::ostream& operator<<(std::ostream& s, const JSON::Value& v); + +#endif -- cgit v1.2.3