[英]how to parse with double quotes array of dictionary into json in ios?
如何为数字添加双引号。 当我解析时,数字不能用双引号引起来。 对于字符串,双引号会很好。 我想要所有的双引号。 下面是我的字典数组
我创建的这个字典数组
(
{
questionId = 91;
responseLanguage = ar;
responseType = 4;
},
{
questionId = 92;
responseLanguage = ar;
responseType = 2;
}
)
我想这样解析
[{"questionId":"91","responseType":"4","responseLanguage":"ar"}, {"questionId":"92","responseType":"2","responseLanguage":"ar"}]
当使用sbjson解析器仅对字符串进行解析时,它使用双引号,对于数字则不使用双引号。
(
{
questionId = @"91";
responseLanguage = ar;
responseType = @"4";
},
{
questionId = @"92";
responseLanguage = ar;
responseType = @"2";
}
)
它将执行此操作,并且如果此数组生成动态数组,则在添加到字典时使用“ stringValue”方法将数字转换为字符串
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
[nsnumber stringValue], @"questionId",
ar, @"responseLanguage",
[nsnumber stringValue], @"responseType", nil];
创建字典时,将数字转换为字符串。 双引号代表字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.