想用逗号分隔绑定字符串 [英] want to bind string using comma separated

查看:67
本文介绍了想用逗号分隔绑定字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的字符串JSON = QUOT; [

{

"的ParentId":" a9764da3147845c184bd272cef6a5937" ;,

"路径":" ; / LMS / Cabinet / bdc2cd8e1da3451c84e332d1aa74f605",

" CreatedBY":" admin",

" IsActive":" Y",

CabinetName:LMS,

" FolderTag":IT mobile computing,Comm Skills,

" Name":" ; JAVA",

" UpdatedBY":"",

" Type":" Folder",

" IsDelete":" N",

" UpdatedON&qu​​ot;:"",

" Id":" bdc2cd8e1da3451c84e332d1aa74f605",

" CreatedON&qu​​ot;:" 2015_09_08-11:19:50",

" TemplateId":" dd42c8a71a954c1d948ef35492ee1242"

},

{

&q uot; ParentId":" a9764da3147845c184bd272cef6a5937",

" Path":" / LMS / Cabinet / 3aae020c256f4dc1ab705af67bede2c7",

" CreatedBY":" admin" ,

IsActive:Y,

" CabinetName":LMS,

" FolderTag": IT移动计算,通信技能,

"名称":Spring,

" UpdatedBY":"",

" Type":" Folder",

" IsDelete":" N",

" UpdatedON&qu​​ot;:"",

"标识":" 3aae020c256f4dc1ab705af67bede2c7" ;,

" CreatedON":" 2015_09_04-16:58:05" ;,

TemplateId:" dd42c8a71a954c1d948ef35492ee1242"

},

{

" ParentId":" a9764da3147845c184bd272cef6a5937 " ;,

"路径":" / LMS /柜/ c139b33a22a94a25bf624b94450aee3e" ;,

" CreatedBY":"管理员" ;,

" IsActive":" Y" ;,

" CabinetName":" LMS" ;,

" FolderTag":"社会技能",

" Name":" SQL",

" UpdatedBY":"",

" Type":"文件夹,

" IsDelete":" N",

" UpdatedON&qu​​ot;:"",

" Id" ;:c139b33a22a94a25bf624b94450aee3e,

" CreatedON&qu​​ot;:2015_09_04-16:54:44",

" TemplateId":dd42c8a71a954c1d948ef35492ee1242"

}

]"



这是我的json字符串,我只希望名字逗号分隔成另一个变量的字段...



例如:字符串res = {" JAVA"," SPRING"," SQL",... }



就像那个plz给我解决方案

解决方案

var objdata =


.parseJSON(json);



在objdata中,您将获得使用for循环的所有值,获取索引6中的值,这是名称

string json="[
{
"ParentId":"a9764da3147845c184bd272cef6a5937",
"Path":"/LMS/Cabinet/bdc2cd8e1da3451c84e332d1aa74f605",
"CreatedBY":"admin",
"IsActive":"Y",
"CabinetName":"LMS",
"FolderTag":"IT mobile computing,Comm Skills",
"Name":"JAVA",
"UpdatedBY":"",
"Type":"Folder",
"IsDelete":"N",
"UpdatedON":"",
"Id":"bdc2cd8e1da3451c84e332d1aa74f605",
"CreatedON":"2015_09_08-11:19:50",
"TemplateId":"dd42c8a71a954c1d948ef35492ee1242"
},
{
"ParentId":"a9764da3147845c184bd272cef6a5937",
"Path":"/LMS/Cabinet/3aae020c256f4dc1ab705af67bede2c7",
"CreatedBY":"admin",
"IsActive":"Y",
"CabinetName":"LMS",
"FolderTag":"IT mobile computing,Comm Skills",
"Name":"Spring",
"UpdatedBY":"",
"Type":"Folder",
"IsDelete":"N",
"UpdatedON":"",
"Id":"3aae020c256f4dc1ab705af67bede2c7",
"CreatedON":"2015_09_04-16:58:05",
"TemplateId":"dd42c8a71a954c1d948ef35492ee1242"
},
{
"ParentId":"a9764da3147845c184bd272cef6a5937",
"Path":"/LMS/Cabinet/c139b33a22a94a25bf624b94450aee3e",
"CreatedBY":"admin",
"IsActive":"Y",
"CabinetName":"LMS",
"FolderTag":"Social Skills",
"Name":"SQL",
"UpdatedBY":"",
"Type":"Folder",
"IsDelete":"N",
"UpdatedON":"",
"Id":"c139b33a22a94a25bf624b94450aee3e",
"CreatedON":"2015_09_04-16:54:44",
"TemplateId":"dd42c8a71a954c1d948ef35492ee1242"
}
] "

this is my json string and i want to only "Name" field with comma separated into another variable...

example: string res={"JAVA","SPRING","SQL",...}

like that plz give me solution

解决方案

var objdata =


.parseJSON(json);

In objdata you will get all the values in which using for loop, get the values in the index 6, which is name


这篇关于想用逗号分隔绑定字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆