shokai / json-builder
json builder for C++. convert from std::map and std::vector to json string.
Clone this repository (size: 49.8 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/shokai/json-builder/
| commit 5: | 835744673732 |
| parent 4: | a333fd3552f9 |
| branch: | default |
NULLも使えるようにしたけどwarning出る
Changed (Δ54 bytes):
raw changeset »
json_builder.h (2 lines added, 1 lines removed)
test/test.cpp (1 lines added, 1 lines removed)
Up to file-list json_builder.h:
6 |
6 |
#include <boost/tuple/tuple.hpp> |
7 |
7 |
#include <boost/format.hpp> |
8 |
8 |
#include <boost/foreach.hpp> |
9 |
|
|
9 |
//#include <boost/regex.hpp> |
|
10 |
10 |
|
11 |
11 |
using namespace std; |
12 |
12 |
using namespace boost; |
| … | … | @@ -45,6 +45,7 @@ namespace json_builder{ |
45 |
45 |
} |
46 |
46 |
else if(value.type() == typeid(int)){ |
47 |
47 |
int n = any_cast<int>(value); |
48 |
if(n == NULL) return string("null"); |
|
48 |
49 |
return str(format("\"%d\"") % n); |
49 |
50 |
} |
50 |
51 |
else if(value.type() == typeid(double)){ |
