开发者社区> 问答> 正文

iOS json parser 解析字符串

(
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "ravi@gmail.com";
 gender = male;
 id = c200;
 name = "Ravi Tamada";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "johnny_depp@gmail.com";
 gender = male;
 id = c201;
 name = "Johnny Depp";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "leonardo_dicaprio@gmail.com";
 gender = male;
 id = c202;
 name = "Leonardo Dicaprio";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "john_wayne@gmail.com";
 gender = male;
 id = c203;
 name = "John Wayne";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "angelina_jolie@gmail.com";
 gender = female;
 id = c204;
 name = "Angelina Jolie";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "dido@gmail.com";
 gender = female;
 id = c205;
 name = Dido;
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "adele@gmail.com";
 gender = female;
 id = c206;
 name = Adele;
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "hugh_jackman@gmail.com";
 gender = male;
 id = c207;
 name = "Hugh Jackman";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "will_smith@gmail.com";
 gender = male;
 id = c208;
 name = "Will Smith";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "clint_eastwood@gmail.com";
 gender = male;
 id = c209;
 name = "Clint Eastwood";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "barack_obama@gmail.com";
 gender = male;
 id = c2010;
 name = "Barack Obama";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "kate_winslet@gmail.com";
 gender = female;
 id = c2011;
 name = "Kate Winslet";
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 },
 {
 address = "xx-xx-xxxx,x - street, x - country";
 email = "eminem@gmail.com";
 gender = male;
 id = c2012;
 name = Eminem;
 phone = {
 home = "00 000000";
 mobile = "+91 0000000000";
 office = "00 000000";
 };
 }
 )

如何解析上面这些数据解析成数据字典的格式

展开
收起
杨冬芳 2016-07-05 13:41:41 2202 0
1 条回答
写回答
取消 提交回答
  • IT从业

    字典?address是key吗?首先你这个不是json格式的 可以使用bejson校验一下ios中json的解析参考这里

    2019-07-17 19:51:23
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
手淘iOS性能优化探索 立即下载
From Java/Android to Swift iOS 立即下载
深入剖析iOS性能优化 立即下载

相关镜像