Created
July 2, 2009 03:29
-
-
Save mattn/139255 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "picojson.h" | |
using namespace std; | |
using namespace picojson; | |
int main(void) { | |
value v; | |
const char *text = "{\"arr\": [1,2,3], \"obj\": {\"foo\": \"bar\"}}"; | |
string err = parse(v, text, text + strlen(text)); | |
cout << "is error? : " << (err.empty() ? "no" : "yes") << endl; | |
cout << "is object?: " << (v.is<object>() ? "yes" : "no") << endl; | |
cout << "is array? : " << (v.is<array>() ? "yes" : "no") << endl; | |
//cout << v.get("arr").to_str() << endl; | |
cout << v.get("arr").to_str() << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment