using Newtonsoft.Json;//引用命名空间
Dictionary<string, string> Content = new Dictionary<string, string>();
Content.Add("bulletinContent", "this is bulletinContent");
Content.Add("topToDay", "this is topToDay"); //Dictionary转json
string Contentjson = JsonConvert.SerializeObject(Content);
//json转Dictionary
Dictionary<string, string> DicContent = (Dictionary<string, string>)JsonConvert.DeserializeObject(Contentjson.ToString());

C# Dictionary类型转json方法之一的更多相关文章

  1. 关于数组类型的json解析方法

    遇到了非常奇葩的数组类型的json,一时解析不出来,用jsonObject会直接报错. Json数据如: [{"id":"1000142","name ...

  2. .Net类型与JSON的映射关系

    首先谢谢大家的支持和关注.本章主要介绍.Net类型与JSON是如何映射的.我们知道JSON中类型基本上有三种:值类型,数组和对象.而.Net中的类型比较多.到底它们是如何映射的呢? 总体来讲,Json ...

  3. Json.Net系列教程 2.Net类型与JSON的映射关系

    原文 Json.Net系列教程 2.Net类型与JSON的映射关系 首先谢谢大家的支持和关注.本章主要介绍.Net类型与JSON是如何映射的.我们知道JSON中类型基本上有三种:值类型,数组和对象.而 ...

  4. python字符类型的一些方法

    python 字符串和字节互转换.bytes(s, encoding = "utf8") str(b, encoding = "utf-8") i.isspac ...

  5. .NET中常用的几种解析JSON方法

    一.基本概念 json是什么? JSON:JavaScript 对象表示法(JavaScript Object Notation). JSON 是一种轻量级的数据交换格式,是存储和交换文本信息的语法. ...

  6. struts2 中的 result 返回类型是 json 的配置问题

    struts2 中的 result 返回类型是 json 的配置问题 1.引入包(本文中的包全部引自struts-2.1.8.1\lib): struts2-json-plugin-2.1.8.1.j ...

  7. Java和JavaScript中使用Json方法大全

    林炳文Evankaka原创作品. 转载请注明出处http://blog.csdn.net/evankaka   摘要:JSON(JavaScript Object Notation) 是一种轻量级的数 ...

  8. 将Dictionary序列化为json数据 、json数据反序列化为Dictionary

    需要引用System.Web.Extensions  dll类库 /// <summary> /// 将json数据反序列化为Dictionary /// </summary> ...

  9. MVC Json方法里的一个坑

    MVC Controller类下面有这样一个方法 // // Summary: // Creates a System.Web.Mvc.JsonResult object that serialize ...

随机推荐

  1. SpringMVC拦截器的配置与使用详解

         一.SpringMVC拦截器简介      Spring MVC的处理器拦截器类似于Servlet开发中的过滤器Filter,用于对处理器进行预处理和后处理.在springmvc中,定义拦截 ...

  2. listen 61

    Multiple Stresses Killed Snail Memory Stress sucks. It can affect your body and mind. Previous resea ...

  3. dead reckoning variation

    Targeting A target is a structure of information that describes the state, and change of state, of a ...

  4. jQuery精华

    第一章:入门 选择元素: $() css() $("li").css():可以省略原生的循环操作 $ == jQuery jQuery方法函数化: click() html() J ...

  5. 1119 Pre- and Post-order Traversals(30 分)

    1119 Pre- and Post-order Traversals(30 分) Suppose that all the keys in a binary tree are distinct po ...

  6. ACM学习历程—HDU 1059 Dividing(dp && 多重背包)

    Description Marsha and Bill own a collection of marbles. They want to split the collection among the ...

  7. 【LeetCode】051. N-Queens

    题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two que ...

  8. MSTAR 平台

    MApp_Menu.c ZUI_exefunc.h //菜单属性 MApp_ZUI_APItables.h #define GETWNDINFO(hwnd) (&g_GUI_WindowLis ...

  9. Divide Two Integers-不用'/' '*' '%'操作实现整数的除法

    题目描述: 不用 '*' '/' 和 '%' 运算实现两个整数的除法 题目来源:http://oj.leetcode.com/problems/divide-two-integers/ 题目分析: 例 ...

  10. static_cast” : 无法从“void (__thiscall CMainFrame::* )(NMTOOLBARA *,LRESULT *)”转换为“void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT

    static_cast” : 无法从“void (__thiscall CMainFrame::* )(NMTOOLBARA *,LRESULT *)”转换为“void (__thiscall CCm ...