Contents

Develop
2013.04.23 17:35

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

Views 80731 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 •

?

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

  2. [android] 점심 해결 앱 소스 코드 ㅋㅋ

  3. [android] 안드로이드 어플 모음 ㅎㅎ

  4. [android] 만화 어플 소스코드

  5. [android] 디바이스(시뮬레이터) hosts 파일 수정하기

  6. [android] SurfaceView를 이용한 애니메이션 ㅎㅎ

  7. [android] How can I place app icon on launcher home screen?

  8. [android] dp, px 서로 변환

  9. [android] Canvas를 이용해 이미지 확대/축소 하기

  10. [android] Calling activity function from separate class

  11. [Android Error] The number of method references in a .dex file cannot exceed 64K

  12. XML, JSON, BSON, MSGPACK 장,단점 비교

Board Pagination Prev 1 2 3 4 5 6 Next
/ 6