Develop/.NET
Json 데이터를 NameValueCollection으로 변환하기...
baragi76
2011. 12. 20. 15:55
Json 데이터로 구성되어있는 데이터를 NameValueCollection으로 변환하여 참조하기 위하여 사용...
참조 예제일 뿐... ^^
기록해 두지 않으면 잊어 먹어싸서...
# 참조
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.Script.Serialization;
public NameValueCollection FromJsonData(string jsonData)
{
JavaScriptSerializer jsData = new JavaScriptSerializer();
Dictionary<string, string> dictionary = jsData.Deserialize<Dictionary<string, string>>(jsonData);
NameValueCollection jsonCollection = new NameValueCollection();
foreach (string key in dictionary.Keys)
{
string value = dictionary[key];
jsonCollection[key] = value;
}
return jsonCollection;
}