在这里,我们将给大家分享关于遍历JSON对象Swift5的知识,让您更了解遍历jsonobject的本质,同时也会涉及到如何更有效地Ajax&Json4.Json的使用&Ajax与Json配合使用、A
在这里,我们将给大家分享关于遍历 JSON 对象 Swift 5的知识,让您更了解遍历jsonobject的本质,同时也会涉及到如何更有效地Ajax & Json 4.Json 的使用 & Ajax 与 Json 配合使用、Android - 封装 JSON 数据(JSON 对象 / JSON 数组)、angular – 如何创建配置文件(tsconfig.json,typings.json,package.json)?、easyUI 这样获取 Json 的内嵌数据 显示 json 下的 json的内容。
本文目录一览:- 遍历 JSON 对象 Swift 5(遍历jsonobject)
- Ajax & Json 4.Json 的使用 & Ajax 与 Json 配合使用
- Android - 封装 JSON 数据(JSON 对象 / JSON 数组)
- angular – 如何创建配置文件(tsconfig.json,typings.json,package.json)?
- easyUI 这样获取 Json 的内嵌数据 显示 json 下的 json
遍历 JSON 对象 Swift 5(遍历jsonobject)
如何解决遍历 JSON 对象 Swift 5
我正在尝试遍历 JSON 对象并获取 swift 编程语言中的特定值。
我收到这样的 JSON
let json = try? JSONSerialization.jsonObject(with: data,options: []) as? [String : Any],let charges = json["charges"] as? [String:Any]
json:
{
object: ''list'',data: [
{
id: ''ch_1IWQEfKn7R1M6tqnhrpyIhMk'',object: ''charge'',amount: 555,amount_captured: 555,amount_refunded: 0,application: ''ca_IXRQuoBh5mSJXXpEccXssma6Oz0u3HjX'',application_fee: ''fee_1IWQEfKn7R1M6tqnvTHQeSEF'',application_fee_amount: 6,balance_transaction: ''txn_1IWQEfKn7R1M6tqnkK9LCNuM'',billing_details: [Object],calculated_statement_descriptor: ''TEST ACCOUNT'',captured: true,created: 1616090777,currency: ''usd'',customer: null,description: null,destination: null,dispute: null,disputed: false,failure_code: null,failure_message: null,fraud_details: {},invoice: null,livemode: false,Metadata: {},on_behalf_of: null,order: null,outcome: [Object],paid: true,payment_intent: ''pi_1IWQEeKn7R1M6tqnYbGfFCzg'',payment_method: ''pm_1IWQEeKn7R1M6tqnKLxSg6vZ'',payment_method_details: [Object],receipt_email: null,receipt_number: null,receipt_url: ''https://pay.stripe.com/receipts/acct_1ISouBKn7R1M6tqn/ch_1IWQEfKn7R1M6tqnhrpyIhMk/rcpt_J8hdy05N6VfomrECdumpti8Jiljz2Et'',refunded: false,refunds: [Object],review: null,shipping: null,source: null,source_transfer: null,statement_descriptor: null,statement_descriptor_suffix: null,status: ''succeeded'',transfer_data: null,transfer_group: null
},{
id: ''ch_1IU62QKn7R1M6tqnbXXlOpch'',amount: 5599,amount_captured: 5599,application_fee: ''fee_1IU62RKn7R1M6tqnLle3zblA'',application_fee_amount: 56,balance_transaction: ''txn_1IU62RKn7R1M6tqn3ttu9F3N'',created: 1615536482,payment_intent: ''pi_1IU62NKn7R1M6tqnWSOLJVge'',payment_method: ''pm_1IU62PKn7R1M6tqnIyOUgUMX'',receipt_url: ''https://pay.stripe.com/receipts/acct_1ISouBKn7R1M6tqn/ch_1IU62QKn7R1M6tqnbXXlOpch/rcpt_J6Id30gjIhQU6AWPBHgUXoujbhFOTyf'',{
id: ''ch_1IU60cKn7R1M6tqny9o2NV5W'',amount: 1000,amount_captured: 1000,application_fee: ''fee_1IU60cKn7R1M6tqn95nUHETe'',application_fee_amount: 10,balance_transaction: ''txn_1IU60cKn7R1M6tqnZKNbSEXf'',created: 1615536370,payment_intent: ''pi_1IU60ZKn7R1M6tqnrUSK1TQD'',payment_method: ''pm_1IU60bKn7R1M6tqnAUHQXqJG'',receipt_url: ''https://pay.stripe.com/receipts/acct_1ISouBKn7R1M6tqn/ch_1IU60cKn7R1M6tqny9o2NV5W/rcpt_J6Ib5PEZQzEgyXWoOwKcxZ9x7mByCVu'',transfer_group: null
}
],has_more: true,url: ''/v1/charges''
}
如何遍历 JSON 对象以接收“金额”、“货币”和“id”。
例如 PSUEDO:
for item in charges {
print(item["amount"])
print(item["currency"])
print(item["id"])
}
我可能未正确初始化 json,例如
json["charges"] 作为? [字符串:任何]
解决方法
您不应该使用 try ?
- 这会抛出错误。始终使用 do/try/catch
以便您处理发生的任何错误,即使您只是打印它们。
JSONSerialization
并将 JSON 解码为数组和字典不是最佳实践。最好创建符合 Codable
的合适结构并使用 JSONDecoder
。
struct Response: Codable {
var object: String
var hasMore: Bool
var data: [ResponseData]
var url: String
enum CodingKeys: String,CodingKey {
case object
case hasMore = "has_more"
case url
case data
}
}
struct ResponseData: Codable {
var amount: Int
var currency: String
var id: String
}
为简单起见,我没有将所有属性添加到 ResponseData
结构中,仅添加了您说过感兴趣的属性
do {
let json = try JSONDecoder().decode(Response.self,from: data)
json.data.forEach { charge in
print(charge.id)
print(charge.currency)
print(charge.ammount)
}
} catch {
print("Error! \\(error)")
}
Ajax & Json 4.Json 的使用 & Ajax 与 Json 配合使用
一、Json 的使用
我们上一篇讲述了 Json 的基本用法,我们还自己写了几个 Json。
我们在写的过程中不难发现,就是这个 \\ 这个转义符添加的问题,这要是让我们写上一个班级的学生数据,那就完蛋了,所以为了不让我们自己去一个一个写,我们引入两种常用的 Json 格式化的 工具
一个是谷歌公司推出的 Gson,还有一个是阿里巴巴推出的 Fastjson
这两个我们用那个都行,看自己选择,我先来说这个 Gson
在此之前,我们创建一个 Student 的类,我们一会要用~~
id 主键
name 姓名
createDt 创建日期
price 自己有多少钱
hobbies 爱好
自己再去添加一下 get/set 方法,还有构造、toString
二、Gson
首先,我们去 maven 仓库,把这个 Gson 的包给他下载下来,下载地址:https://mvnrepository.com/artifact/com.google.code.gson/gson/2.8.6
下载下来之后,我们放到我们之前的 AjaxHelloWorld 项目中
然后,我们来写一个 GsonTest。
首先,我们先实例化一个 Student 的集合,然后,给这个集合赋一些初始值,后面要用
然后我们来开始做操作
1. 实例化一个简单的 Json 对象
这里我们需要用到 Gson 给我们提供的 JsonObject 对象,我们用它来创建对象,然后调用 addProperty 方法,给这个对象添加键值对
这里注意一下,看清楚导入的包,我们使用的是 import com.google.gson.JsonObject; 运行一下
当然了,这里我们再来试试别的
注意,这里只能添加引用类型,不能添加基本数据类型的值!!
可以看到,我们又添加了一个 key 为 123 的对象,但是并没有显示,而是做了替换,这个就是我之前说的,同一个 key 不可能存在同一个层级下。
2. 实例化一个简单的 Json 数组
实例化 Json 数组,我们是使用的 Gson 给我们提供的 JsonArray,添加对象需要调用 add 方法,如下
然后我们创建两个 JsonObject 对象,存放到这个数组中
运行一下,看看输出什么
可以看到,是一个数组对象
3. 将 list 集合转换成 Json
我们再来写一个方法,将我们之前定义的 list 集合转换成我们的 Json,这里其实我们调用的是 Gson 提供的 toJson 方法,我们来看一下
我们运行一下,看看效果
是没有问题的,我们把结果复制到 Json 检查的网站去检测一下
也是没有问题的
这里我要说一下,这个 Gson 对象的 toJson 方法有很多重载方法,可以将很多种数据结构的对象转换成 Json 对象,大家可以自己去研究研究(集合都可以转换,更不要说单个对象什么的了)
4. 将 Json 转换成 Java 对象
我们将 Json 字符串 转换成 Java 对象,这里呢,我们用刚刚生成的 Json 来进行测试
这里呢,我们需要用到 Gson 给我们提供的 fromJson 方法,这个 fromJson 方法里面有很多的构造函数
可以看到,提供的很全哈,我们这里使用倒数第二个,这里还需要多加一个类的支持
还有一点,这里需要知道具体的 Json 对象的格式,不然会报错,一般情况下,我们都是知道这个格式,然后进行转换
我们把这个 Json 数组转换成 List 集合,然后进行遍历输出一下
是没有问题的啊,因为我们只有一个对象,所以只能遍历出一个,当然啊,这里字段需要对应,不对应也是没有办法将这些值赋值给我们的对象中的属性的
三、FastJson
其实,FastJson 和 Gson 非常类似,仅仅是调用的函数名称不同,参数不同点而已,其他的使用方式都是类似的,FastJson Maven 下载地址:https://mvnrepository.com/artifact/com.alibaba/fastjson/1.2.75
下载好同样扔到我们的项目中
这里我直接上代码了,不说那么多废话了
1. 创建普通 Json 对象
这里要注意一下,Gson 给我们提供的是 JsonObject,阿里的 FastJson 给我们提供的是 JSONObject 不一样啊,看清楚了~~
2. 创建 Json 数组
3. list 集合转换 Json
这里需要注意的是,JSONObject 这个对象使用 toJSON 方法后,返回的是一个 Object 对象,这个对象最好强转成 JSONArray,或者是 JSONObject 去接收
4. Json 字符串转换成对象
这里是因为 JSONObject 调用 parse 之后,返回的是一个 Object 对象,因为我知道他是什么类型的,所以我就使用 List 进行接收
总体来说,两个都功能差不多,性能方面,是 FastJson 更好,但是相比这样的强转,我更喜欢 Gson 的转换~,当然,具体使用什么,看你自己~
四、Json 和 Ajax 配合使用
这里我们用 Gson 来实现一下它俩的配合~
我们先来修改一下我们之前的那个 Servlet
我们使用 JsonObject 将 Json 返回到前端,前端我们不变,我们继续使用 index2.html 进行测试,启动服务器,我们看一下结果
是 OK 的啊。
我们接下来修改一下,我们使用 $.get 方式进行获取一下,我们再来复制一个 index3.html
从新启动一下服务器,我们再来看看能不能行
也是可以的
当然,POST 也是可以的
原因就是我们这里调用了 doGet
Ajax 与 Json 就讲完了,希望大家可以好好学习理解他们,毕竟这玩意需要陪我们很久的
大家可以自己好好查查看,有不懂的可以联系我 QQ:2100363119
欢迎大家访问我的网站:https://www.lemon1234.com
可以的话关注一下我的公众号,就在我网站,每天都有更新~~~,无限资源畅游 Java,感谢~
最近小程序也开放了,大家可以扫码进行玩玩看
Android - 封装 JSON 数据(JSON 对象 / JSON 数组)
Android - 封装 JSON 数据(JSON 对象 / JSON 数组),一般情况下不会在 Android 端封装 JSON 的数据,因为封装 JSON 的数据是在服务器端进行封装了,Android 更多的工作是解析(JSON 对象 / JSON 数组)
而且在服务端封装 JSON 会更加简单灵活:
例如:JsonTools.createJsonString ("persons", list);/JsonTools.createJsonString ("person", person);
而这篇博客是讲解在 Android - 封装 JSON 数据(JSON 对象 / JSON 数组),只为熟悉 JSON 数据格式,真实开发中更多的是去解析 JSON 数据(JSON 对象 / JSON 数组)
注意:⚠ 千万不要 jsonObject.toString ()
否则会 在前面加 "后面也加" , 都在 json 数据有问题
package liudeli.mynetwork01;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.FileOutputStream;
public class MainActivity extends Activity {
private final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* 封装JSON对象数据
* {
* "name":"李四",
* "age":99,
* "hobby":"爱好是练习截拳道"
* }
*
* @param view
*/
public void pottingJSON1(View view) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("name", "李四");
jsonObject.put("age", 99);
jsonObject.put("hobby", "爱好是练习截拳道");
} catch (JSONException e) {
e.printStackTrace();
} finally {
Log.d(TAG, "jsonObject:" + jsonObject);
saveJSONDataToFile("pottingJSON1", jsonObject);
}
}
/**
* 封装JSON对象-带Key(student)
* {
* "Student":{
* "name":"李四",
* "age":99,
* "hobby":"爱好是练习截拳道"
* }
* }
*
* @param view
*/
public void pottingJSON2(View view) {
JSONObject jsonObjectALL = null;
try {
// student json 对象
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "李四");
jsonObject.put("age", 99);
jsonObject.put("hobby", "爱好是练习截拳道");
// 整个最大的 json 对象
jsonObjectALL = new JSONObject();
/**
* 注意:⚠ 千万不要jsonObject.toString()
* 否则会 在前面加" 后面也加" , 都在json数据有问题
*/
jsonObjectALL.put("student", jsonObject);
} catch (JSONException e) {
e.printStackTrace();
} finally {
Log.d(TAG, "jsonObjectALL:" + jsonObjectALL);
saveJSONDataToFile("pottingJSON2", jsonObjectALL);
}
}
/**
* 封装JSON对象-嵌套对象
* {
* "student":{
* "name":"李四",
* "age":99,
* "hobby":"爱好是练习截拳道",
* "dog":{
* "name":"阿黄",
* "age":"77",
* "sex":"母"
* }
* }
* }
* @param view
*/
public void pottingJSON3(View view) {
JSONObject jsonObjectALL = null;
try {
// dog json 对象
JSONObject dogJSONObject = new JSONObject();
dogJSONObject.put("name", "阿黄");
dogJSONObject.put("age", 77);
dogJSONObject.put("sex", "母");
// student json 对象
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "李四");
jsonObject.put("age", 99);
jsonObject.put("hobby", "爱好是练习截拳道");
/**
* 注意:⚠ 千万不要dogJSONObject.toString()
* 否则会 在前面加" 后面也加" , 都在json数据有问题
*/
jsonObject.put("dog", dogJSONObject);
// 整个最大的 json 对象
jsonObjectALL = new JSONObject();
/**
* 注意:⚠ 千万不要jsonObject.toString()
* 否则会 在前面加" 后面也加" , 都在json数据有问题
*/
jsonObjectALL.put("student", jsonObject);
} catch (JSONException e) {
e.printStackTrace();
} finally {
Log.d(TAG, "jsonObjectALL:" + jsonObjectALL);
saveJSONDataToFile("pottingJSON3", jsonObjectALL);
}
}
/**
* 封装JSON数组
* [
* {
* "name":"君君",
* "age":89,
* "sex":"男"
* },
* {
* "name":"小君",
* "age":99,
* "sex":"女"
* },
* {
* "name":"大君",
* "age":88,
* "sex":"男"
* }
* ]
*/
public void pottingJSONArray1(View view) {
try {
// 第一个JSON对象
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "君君");
jsonObject.put("age", 89);
jsonObject.put("sex", "男");
// 第二个JSON对象
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("name", "小君");
jsonObject2.put("age", 99);
jsonObject2.put("sex", "女");
// 第三个JSON对象
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("name", "大君");
jsonObject3.put("age", 88);
jsonObject3.put("sex", "男");
// 定义个JSON数组,把上面的三个JSON对象装进去
JSONArray jsonArray = new JSONArray();
jsonArray.put(0, jsonObject);
jsonArray.put(1, jsonObject2);
jsonArray.put(2, jsonObject3);
Log.d(TAG, "jsonArray:" + jsonArray);
saveJSONDataToFile("pottingJSONArray1", jsonArray);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 封装JSON数组-带Key
* {
* "person":[
* {
* "name":"君君",
* "age":89,
* "sex":"男"
* },
* {
* "name":"小君",
* "age":99,
* "sex":"女"
* },
* {
* "name":"大君",
* "age":88,
* "sex":"男"
* }
* ]
* }
* @param view
*/
public void pottingJSONArray2(View view) {
try {
// 第一个JSON对象
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", "君君");
jsonObject.put("age", 89);
jsonObject.put("sex", "男");
// 第二个JSON对象
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("name", "小君");
jsonObject2.put("age", 99);
jsonObject2.put("sex", "女");
// 第三个JSON对象
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("name", "大君");
jsonObject3.put("age", 88);
jsonObject3.put("sex", "男");
// 定义个JSON数组,把上面的三个JSON对象装进去
JSONArray jsonArray = new JSONArray();
jsonArray.put(0, jsonObject);
jsonArray.put(1, jsonObject2);
jsonArray.put(2, jsonObject3);
// 整个最大的 json 对象
JSONObject jsonObjectAll = new JSONObject();
// 把上面的JSON数组,装进去
jsonObjectAll.put("person", jsonArray);
Log.d(TAG, "jsonObjectAll:" + jsonObjectAll);
saveJSONDataToFile("pottingJSONArray2", jsonObjectAll);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 保存JSON数据到文件
*/
private void saveJSONDataToFile(String fileName, JSONObject jsonData) {
try {
FileOutputStream fos = openFileOutput(fileName, Context.MODE_PRIVATE);
fos.write(jsonData.toString().getBytes());
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 保存JSON数据到文件
*/
private void saveJSONDataToFile(String fileName, JSONArray jsonData) {
try {
FileOutputStream fos = openFileOutput(fileName, Context.MODE_PRIVATE);
fos.write(jsonData.toString().getBytes());
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
布局代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="封装JSON对象"
android:onClick="pottingJSON1"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="封装JSON对象-带Key"
android:onClick="pottingJSON2"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="封装JSON对象-嵌套对象"
android:onClick="pottingJSON3"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="封装JSON数组"
android:onClick="pottingJSONArray1"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="封装JSON数组-带Key"
android:onClick="pottingJSONArray2"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
结果;
/data/data/liudeli.mynetwork01/files/pottingJSON1
{
"name":"李四",
"age":99,
"hobby":"爱好是练习截拳道"
}
/data/data/liudeli.mynetwork01/files/pottingJSON2
{
"student":{
"name":"李四",
"age":99,
"hobby":"爱好是练习截拳道"
}
}
/data/data/liudeli.mynetwork01/files/pottingJSON3
{
"student":{
"name":"李四",
"age":99,
"hobby":"爱好是练习截拳道",
"dog":{
"name":"阿黄",
"age":77,
"sex":"母"
}
}
}
/data/data/liudeli.mynetwork01/files/pottingJSONArray1
[
{
"name":"君君",
"age":89,
"sex":"男"
},
{
"name":"小君",
"age":99,
"sex":"女"
},
{
"name":"大君",
"age":88,
"sex":"男"
}
]
/data/data/liudeli.mynetwork01/files/pottingJSONArray2
{
"person":[
{
"name":"君君",
"age":89,
"sex":"男"
},
{
"name":"小君",
"age":99,
"sex":"女"
},
{
"name":"大君",
"age":88,
"sex":"男"
}
]
}
angular – 如何创建配置文件(tsconfig.json,typings.json,package.json)?
但我想更多地了解这些文件.
我们如何手动创建它?
从哪里可以了解更多关于这些文件的信息?
包括有关项目使用的包和库的信息,
还可以包含npm脚本,它有助于运行应用程序的任务,如运行测试,构建js等等……
npm init来初始化新的package.json文件
文档:
npm docs
tsconfig.json
提供有关将过程打字稿编译为javascript的信息.在哪个版本应该编译ts,js文件应该包括源映射,以及此文件中通常描述的此类信息.
tsc –init到init新的tsconfig.json文件
docs:tsconfig docs
typings.json
包括对外部库的定义类型文件的引用,它可以帮助您的应用程序更智能感知.如果要为应用程序编写类型,则需要了解所使用的其他库的类型.
typings init初始化新的typings.json文件(应全局或本地安装)
更多信息:
typings package(帮助生成typings.json文件并保存依赖项)
types defenitions(库类型定义数据库)
full tsconfig scheme
希望它能帮到你!
easyUI 这样获取 Json 的内嵌数据 显示 json 下的 json
先给出返回的 json 数据。
{
"total": "2",
"rows": [
{
"id": "1",
"name": "张富银",
"xiuhao": "2014009012",
"exttend": {
"sid": "1",
"tid": "1",
"tel": "18580711609",
"qq": "564968550",
"email": "myfirtyou@qq.com",
"sxdw": "重庆源代码教育咨询有限公司",
"sxdw_add": "重庆市永川区",
"jjlxrtel": "15922879092"
}
},
{
"id": "4",
"name": "测试学生姓名",
"xiuhao": "2014009013",
"exttend": {
"sid": "4",
"tid": "1",
"tel": "1234567890",
"qq": "12345",
"email": "test@qq.com",
"sxdw": "实习单位",
"sxdw_add": "单位地址",
"jjlxrtel": "1234567890"
}
}
]
}
昨天遇到这样一个问题,在取 exttend 里面的信息时,我使用了 如下的方式:
{
field: ''sxdw''
,
title:
''实习单位''
,
width: 60,
formatter:
function
(value, rec) {
return
rec.extend.sxdw;
}
},
这样可以取出 sxdw 的值,但是账号类型,性别也显示实习单位地址的值。不知道问题出在哪,在网上搜索,看到给出的解决办法都是返回 rec.extend.sxdw; 这样,但是只返回一个字段,这样肯定可以返回正确的值了,但是我要返回的是很多个字段。真是没办法了,就随便试 试吧,我把 field:’sxdw’改成 field:’extend.sxdw,再运行一次,竟然得到了我想要的结果。
下面是完整的代码:


1 $(''#student_list'').datagrid({
2 fit:true,
3 fitColumns : true,
4 rownumbers : true,
5 border : false,
6 striped : true,
7 url:Thinkphp[''MODULE'']+''/student/getInfo/'',
8 toolbar : ''#student_tool'',
9 rownumbers:true,//显示行号
10 pagination:true,//显示分页工具条
11 pageList : [15, 30, 45],
12 pageNumber : 1,
13 pageSize : 15,
14 sortName : ''id'',
15 sortOrder : ''ASC'',
16 columns:[[
17 {
18 field:''id'',
19 title:''编号'',
20 checkbox:true,
21 width:100,
22 },{
23 field:''name'',
24 title:''姓名'',
25 sortable:true,
26 width:100,
27 },{
28 field:''xiuhao'',
29 title:''学号'',
30 sortable:true,
31 width:100,
32 },{
33 field:''exttend.teacher'',
34 title:''指导教师'',
35 sortable:true,
36 width:100,
37 },
38 {
39 field:''exttend.tel'',
40 title:''电话'',
41 sortable:true,
42 width:100,
43 formatter: function (value, rec) {
44 return rec.exttend[''tel''];
45 }
46 },{
47 field:''exttend.qq'',
48 title:''QQ'',
49 width:80,
50 formatter: function (value, rec) {
51 return rec.exttend[''qq''];
52 }
53 },{
54 field:''exttend.email'',
55 title:''电子邮件'',
56 width:100,
57 formatter: function (value, row) {
58 return row.exttend.email;
59 }
60 },{
61 field:''exttend.sxdw'',
62 title:''实习单位'',
63 width:150,
64 formatter: function (value, row) {
65 return row.exttend.sxdw;
66 }
67 }, {
68 field:''exttend.sxdw_add'',
69 title:''实习单位地址'',
70 width:150,
71 formatter: function (value, row) {
72 return row.exttend.sxdw_add;
73 }
74 },{
75 field:''exttend.jjlxrtel'',
76 title:''紧急联系人电话'',
77 width:100,
78 formatter: function (value, row) {
79 return row.exttend.jjlxrtel;
80 }
81 },
82 ]]
83 });
今天关于遍历 JSON 对象 Swift 5和遍历jsonobject的介绍到此结束,谢谢您的阅读,有关Ajax & Json 4.Json 的使用 & Ajax 与 Json 配合使用、Android - 封装 JSON 数据(JSON 对象 / JSON 数组)、angular – 如何创建配置文件(tsconfig.json,typings.json,package.json)?、easyUI 这样获取 Json 的内嵌数据 显示 json 下的 json等更多相关知识的信息可以在本站进行查询。
本文标签: