首页 > 其他分享 >json串的使用与操作

json串的使用与操作

时间:2023-02-06 20:36:55浏览次数:42  
标签:遍历 对象 label json 数组 使用 operator 操作 model


在controller中从后台数据库取出的json信息,怎样获取和怎么遍历?
1.param中的信息用用result[0] 还是result?
想了很久,后来发现是你付处理信息数输出一个对象还是对个对象的问题,这只能根据你的条件去选择


{
"action": "888",
"status": "200",

"param": [
{
"user_id": "007",
"process_control_point_list": [
{
"operator": "大话西游1"
},
{
"operator": "大话西游2"
},
{
"operator": "大话西游3"
}
],
"label": {
"label_file_url": "aaa",
"name": "zxc"
},


"additive_list": [
{
"name": "tyryrt",
"num": "10",
}
]
}
]
}



获取第一个对象的信息用model = result[0];
"process_control_point_list"中信息的遍历:(数组对象中的信息)
<tr ng-repeat="item in model.process_control_point_list">
<td> {{item.operator}} </td>
</tr>

遍历user_id: 遍历数组对象中的属性的信息:
model.user_id
遍历数组对象中数组的对象:"label":
1.htmo中model.label.label_file_url
2.js循环:
for (i in model.label) {
x += model.label[i] + "<br>";
}
遍历数组对象中的属性的数组对象的遍历:
<tr ng-repeat="item in model.additive_list">
<td> {{item.name}} </td>
<td> {{item.num}} </td>
</tr>


标签:遍历,对象,label,json,数组,使用,operator,操作,model
From: https://blog.51cto.com/u_15955675/6040439

相关文章

  • list使用1
    #include<iostream>#include<list>usingnamespacestd;voidPrintListContents(constlist<int>&listInput);intmain(){list<int>a;//在链表前添加数据......
  • Git操作—— git add --all、git add.、git add * 的区别(转)
    原文:https://blog.csdn.net/W664160450/article/details/123715481?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-12......
  • vector使用2
    #include<iostream>#include<vector>#include<string>usingnamespacestd;structDog{};intmain(){/*vector动态数组vector<int>ivec;//ivec是空的......
  • Obsidian 插件(二):Advanced_Slides 的使用
    目录AdvancedSlides的使用一、概述1、简介2、特征3、第一个PPT二、基础语法1、水平垂直幻灯片2、元素注释3、幻灯片注释4、块注解5、元素动画6、内联样式7、......
  • flea-jersey使用之Flea RESTful接口客户端接入
    FleaRESTful接口客户端接入本篇介绍flea-jersey模块下的flea-jersey-client子模块,该模块提供对flea-jersey-server子模块封装的POST、PUT、DELETE和GET资源的调......
  • 在IIS上同站点部署多个程序操作步骤
    1、打开IIS管理器;  2、右击选中“网站”,选择“添加网站”;输入网站名称、路径、IP地址等信息;  3、确定后并访问网站;部署后可能会因为框架不支持导致报错,比如.NET......
  • SpringBoot响应Json数据乱码通过配置解决
    场景实现把SpringBoot的response编码设置为utf-8找到application.properties配置文件添加如下:#设置响应为utf-8spring.http.encoding.force-response=true 再次刷新浏览器......
  • React中使用路由
     安装:npminstallreact-router-domlocalforagematch-sortersort-by 声明router当安装好路由后就需要在main.js中声明以便可以引入importrouterfrom"./ro......
  • SpringBoot+MyBatis的动态SQL、使用动态SQL时List传值错误解决方案
    目录实现动态SQL的四种方式:1、XML配置2、脚本SQL3、在方法中构建SQL4、结构化SQL关于动态SQL的List传值错误问题1、错误代码2、解决错误实现动态SQL的四种方式:1、XML配置......
  • 使用popup.remove()仍然不能移除popup的原因
    今天遇到一个问题  添加完popup之后 想要移除popup,,然后使用popup.remove这个方法还是不管用,popup.remove()后还是会有一个空白的popup在页面上。博主高考语文不及格......