json字符串转为Java对象请教

2025-01-05 22:04:41
推荐回答(4个)
回答1:

用这个JSON试试
[{'handleName':'查看','imgsrc':'../../images/folder_open.png','href':'initEditRole.act','args':[{'argName':'role.id','propertyName':'id'}],'onclick':''},{'handleName':'删除','imgsrc':'../../images/folder_delete.png','href':'deletesRole.act','args':[{'argName':'role.id','propertyName':'id'}],'onclick':'javascript:return confirm(\'是否确定删除?\');'}]

在[]外面不应该有引号

回答2:

:[{'handleName':'查看'
要用双引号 “handleName”:“查看”
如String s="[{“/handleName”/:“/查看”/}]"

回答3:

数组的话用JSONArray这个类来处理不是JSONObject

回答4:

加【】一个是数组