Contents

Develop
2013.04.23 17:35

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

Views 80732 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
# 샘플코드
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
No. Category Subject Author Date Views
60 Develop [ios] Facebook Cache 갱신하는 함수 file hooni 2017.02.27 1332
59 Develop [ios] Facebook SDK 로그인 설명 file hooni 2017.04.19 1367
58 Develop [ios] FlckrFeed Example App (Swift) file hooni 2016.11.27 1214
57 Develop [ios] iOS 4.0 beta 에서 3.1.3으로 다운그레이드 하는 법 file hooni 2013.04.23 37543
56 Develop [ios] NavigationController 에서 왼쪽(back) 버튼 후킹하기 hooni 2015.10.23 1306
55 Develop [ios] NSString, RegularExpression Find/Replace hooni 2017.04.14 964
54 Develop [ios] Random Thoughts: Rand() vs. arc4random() hooni 2013.10.31 68125
53 Develop [ios] Requesting Location Permissions in iOS file hooni 2018.08.18 1746
52 Develop [ios] UIAlertView 초간단 샘플 ㅎㅎ hooni 2013.10.14 46207
51 Develop [ios] UIView에서 상위 UIViewController 가져오기 hooni 2013.09.27 20259
50 Develop [ios] UUID 생성 + Key Chain 연동 file hooni 2016.05.13 4793
49 Develop [ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법 file hooni 2017.03.29 1098
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7