Contents

Develop
2013.04.23 17:35

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

조회 수 80655 댓글 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 •

?

  1. '2014 모바일 개발 트렌드' 발표자료입니다.

    Date2014.10.02 CategoryDevelop Byhooni Views983
    Read More
  2. Aspect Oriented Programming in Objective-C

    Date2015.05.18 CategoryDevelop Byhooni Views676
    Read More
  3. DDay Memo 1.9.4 소스코드

    Date2015.10.03 CategoryDevelop Byhooni Views0
    Read More
  4. GCM 사용하기 2 (단말에 GCM 구현하기)

    Date2013.07.06 CategoryDevelop Byhooni Views23248
    Read More
  5. GCM 사용하기 3 (JSP로 GCM 푸시 서버 만들기)

    Date2013.07.06 CategoryDevelop Byhooni Views25315
    Read More
  6. git 브런치 배우기 (링크)

    Date2013.07.09 CategoryDevelop Byhooni Views20571
    Read More
  7. GPL, AGPL, MPL,.. 한눈에 보는 오픈소스SW 라이선스

    Date2014.10.14 CategoryDevelop Byhooni Views1146
    Read More
  8. How to Test SMTP AUTH using Telnet

    Date2018.04.05 CategoryDevelop Byhooni Views1342
    Read More
  9. JSON, BSON 변환

    Date2013.04.23 CategoryDevelop Byhooni Views11814
    Read More
  10. Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

    Date2018.01.24 CategoryDevelop Byhooni Views1662
    Read More
  11. Mac OS 에 Jenkins 설치하기 (Homebrew)

    Date2017.03.15 CategoryDevelop Byhooni Views8121
    Read More
  12. macOS에 node, npm 설치하기 (homebrew)

    Date2021.11.06 CategoryDevelop Byhooni Views1148
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71