Contents

Develop
2013.04.23 17:35

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

조회 수 80657 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
9 Etc EBS [수학영역] 미적분과 통계 기본 - 정규분포의 의미와 특징은? hooni 2015.04.20 1006
8 Develop DDay Memo 1.9.4 소스코드 secret hooni 2015.10.03 0
7 System/OS Configure Postfix to Use Gmail SMTP on Ubuntu 18.04 file hooni 2020.02.07 1256
6 System/OS CentOS 에서 Cacti 설치하기 hooni 2015.01.02 1770
5 System/OS CentOS 6.5 USB 설치 6 file hooni 2013.12.18 37680
4 System/OS asx미디어 정보 기록.. hooni 2003.04.23 20534
3 Develop Aspect Oriented Programming in Objective-C hooni 2015.05.18 676
2 System/OS Apache CORS 설정 1 hooni 2020.09.04 2721
1 Develop '2014 모바일 개발 트렌드' 발표자료입니다. file hooni 2014.10.02 986
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98