带有嵌套 JSON 的 Bootstrap 表
我正在尝试引用 JSON 文件中的值以显示在引导表中。 JSON 文件的选择如下:
{
"summary": [
"2022-03-03 02:52:39 UTC P @ OD06 - 2022-03-03 04:00:08 UTC 01+07 LOW SJ SJ-DG-QM-CB-CL-HT-HV-HZ",
"2022-03-03 03:29:29 UTC E @ OD19 - 2022-03-03 15:01:25 UTC 11+31 HIGH ZV ZV-TA-MI-FC-FY-AL-TU-BR-KN-WH-VT",
"2022-03-03 03:46:59 UTC F @ OD18 - 2022-03-03 15:22:16 UTC 11+35 HIGH GO GO-FR-BO-NA-HI-GR-CH-VN-QY-FO-GY-SA-NS-JE"
],
"detail": [
{
"_id": {
"$oid": "62330bd6eefd332ac0855c52"
},
"duration": 4049,
"edate": "2022-03-03T04:00:08.000Z",
"expires_at": "2024-11-27T02:52:39.000Z",
"flightinfo": {
"numberofac": 9,
"flightmins": 160,
"pace": 4,
"interval": 300,
"sdate": "2022-03-03T02:52:39.000Z",
"edate": "2022-03-03T04:00:08.000Z"
},
"json_class": "SectorOpen",
"lastsrtreport": "20220303040008.0000045306",
"master": "SJ",
"od": "06",
"sdate": "2022-03-03T02:52:39.000Z",
"slaves": [
"DG",
"CL",
"QM",
"CB",
"HT",
"HZ",
"HV"
]
}
]
}
我试图在引导表中显示“主”键的值。
该值的路径是 $.detail[*].master ,当我使用 JSONPath.com 验证它时,它按预期返回“SJ”的值。
但是,我无法获取要在表中显示的值。
这是该表的 html:
<table id="table" data-toggle="table" data-url="data.json">
<thead>
<tr>
<th data-field="$.detail[*].master">Master</th>
</tr>
</thead>
</table>
我做错了什么?这是返回 JSON 的格式吗?
谢谢你!
I am trying to reference a value in my JSON file to display in a bootstrap table. A selection of the JSON file is as follows:
{
"summary": [
"2022-03-03 02:52:39 UTC P @ OD06 - 2022-03-03 04:00:08 UTC 01+07 LOW SJ SJ-DG-QM-CB-CL-HT-HV-HZ",
"2022-03-03 03:29:29 UTC E @ OD19 - 2022-03-03 15:01:25 UTC 11+31 HIGH ZV ZV-TA-MI-FC-FY-AL-TU-BR-KN-WH-VT",
"2022-03-03 03:46:59 UTC F @ OD18 - 2022-03-03 15:22:16 UTC 11+35 HIGH GO GO-FR-BO-NA-HI-GR-CH-VN-QY-FO-GY-SA-NS-JE"
],
"detail": [
{
"_id": {
"$oid": "62330bd6eefd332ac0855c52"
},
"duration": 4049,
"edate": "2022-03-03T04:00:08.000Z",
"expires_at": "2024-11-27T02:52:39.000Z",
"flightinfo": {
"numberofac": 9,
"flightmins": 160,
"pace": 4,
"interval": 300,
"sdate": "2022-03-03T02:52:39.000Z",
"edate": "2022-03-03T04:00:08.000Z"
},
"json_class": "SectorOpen",
"lastsrtreport": "20220303040008.0000045306",
"master": "SJ",
"od": "06",
"sdate": "2022-03-03T02:52:39.000Z",
"slaves": [
"DG",
"CL",
"QM",
"CB",
"HT",
"HZ",
"HV"
]
}
]
}
I am trying to display the value of the "master" key in a bootstrap table.
The path to the value is $.detail[*].master and returns the value of "SJ" as expected when I use JSONPath.com to validate it.
However, I can't get the value to display in the table.
This is the html for the table:
<table id="table" data-toggle="table" data-url="data.json">
<thead>
<tr>
<th data-field="$.detail[*].master">Master</th>
</tr>
</thead>
</table>
What am I doing wrong? Is it the format that the JSON is being returned?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论