2010-06 << 2010-07 >> 2010-08

2010-07-02 (金)

*サンプル

ちょうど良いデータがあったので,json.hのサンプルコード書いてみた.

// ご結婚おめでとうございます
#include <iostream>
#include "json.h"
#include "http.h"
#include "encode.h"
using namespace std;

int main(int argc,int argv[])
{
    Net::HttpClient http;
    string json = http.get_content("http://keccon2010.appspot.com/script/api/entrant");

    json::jsvalue list;
    json::parse(list, json);

    for (int i=0; i<list["result"].size();i++ ) {
        cout << (string)list["result"][i]["username"] << " (" ;
        cout << Encode::encode((string)list["result"][i]["name"],Encode::UTF8,Encode::SJIS) << ")" << endl;
    }

    cout << list["result"].size() << endl;
}
2010-06 << 2010-07 >> 2010-08