Contents

Develop
2013.04.23 17:35

[c#] Hashtable <-> Json (dll 포함)

조회 수 80649 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
# 샘플코드
using System.Net.Json;

public string ConvertHashtableToJson(Hashtable data)
{
    JsonObjectCollection result = new JsonObjectCollection();

    foreach(DictionaryEntry item in data)
    {
        result.Add(new JsonStringValue(item.Key.ToString(),
            item.Value.ToString()));
    } 

    return result.ToString();
}

public Hashtable ConvertJsonToHashtable(string json)
{
    JsonTextParser parse = new JsonTextParser();
    JsonObject object = parse.Parse(json);
    Hashtable result = new Hashtable();

    foreach(JsonObject item in obj as JsonObjectCollection)
    {
        result.add(item.Name, item.GetValue().ToString());
    }
}

[참고] http://bit.ly/hYMCLL (여기와 같은 dll을 업로드 함.)
TAG •

?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
» Develop [c#] Hashtable <-> Json (dll 포함) file hooni 2013.04.23 80649
1 Develop [C#] MD5, SHA1 해시 & 인코딩 hooni 2013.04.23 77851
Board Pagination Prev 1 Next
/ 1