NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];

[dictionary setValue:@"hello" forKey:@"one"];

[dictionary setValue:@"world" forKey:@"two"];

NSArray *arry=[NSArray arrayWithObjects:@"001",@"002",@"003", nil];

[dictionary setValue:arry forKey:@"three"];

NSData *data=[NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:nil];

NSString *jsonStr=[[NSString alloc]initWithData:dataencoding:NSUTF8StringEncoding];

NSLog(@"jsonStr==%@",jsonStr);

输出结果为:

str=={

  "one" : "hello",

  "two" : "world",

  "three" : [

    "001",

    "002",

    "003"

  ]

}

 

最新文章

  1. 修复百度编辑器(UM)禁用时上传图片按钮还可点击的BUG;
  2. Web Components是不是Web的未来
  3. Doctrine2 SQL语句
  4. windows内核编程之常用数据结构
  5. [转载]Android 编译环境 build/envsetup.sh分析
  6. css选择器权值
  7. 在ubuntu上搭建reviewboard
  8. mysql_upgrade命令
  9. TYPE C PD测试板 UFP测试板
  10. Sequence《优先队列》
  11. delphi 发送Windwos消息控制按钮(控制计算器里的某一个按钮)
  12. /system改成可写
  13. python_嵌套列表变成普通列表
  14. react-native-image-picker 运用launchCamera直接调取摄像头的缺陷及修复
  15. org.apache.catalina.core.StandardContext.startInternal Context [/test] startup failed due to previou
  16. [译]Ocelot - Claims Transformation
  17. jqueryd的post传递表单以及取消表单的默认传递
  18. for...else 小记
  19. POJ 1200 Crazy Search (哈希)
  20. docker+jenkins实现spring boot项目持续集成自动化部署

热门文章

  1. [转]在Storyboard中使用自定义的segue类型
  2. [SaltStack] salt-minion启动流程
  3. C#性能优化篇 - 基于索引器封装EPList
  4. Codeforces 最大流 费用流
  5. Codeforces 323C Two permutations
  6. dedecms调用文章发布日期
  7. 处理类型(typedef,uisng,auto,decltype)
  8. MFC中 创建基于CFormView的文档视图程序
  9. 自学MVC看这里——全网最全ASP.NET MVC 教程汇总【转】
  10. Windows下ELK-5.4.3环境搭建