已关闭。此问题需要超过focused。当前不接受答案。
**想要改进此问题吗?**更新此问题,使其仅关注editing this post的一个问题。
3天前关闭。
Improve this question
我正在寻找转换一个表格式的字符串,这是一个纽曼响应JSON格式。下面是字符串
┌─────────────────────────┬────────────────────┬───────────────────┐
│ │ executed │ failed │
├─────────────────────────┼────────────────────┼───────────────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│ requests │ 30 │ 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│ test-scripts │ 60 │ 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│ prerequest-scripts │ 38 │ 0 │
├─────────────────────────┼────────────────────┼───────────────────┤
│ assertions │ 56 │ 0 │
├─────────────────────────┴────────────────────┴───────────────────┤
│ total run duration: 8.9s │
├──────────────────────────────────────────────────────────────────┤
│ total data received: 8.19kB (approx) │
├──────────────────────────────────────────────────────────────────┤
│ average response time: 267ms │
└──────────────────────────────────────────────────────────────────┘
我正在尝试将上述内容转换为如下所示的json响应
{
"iterations": {
"executed" : 1,
"failed" : 0
},
"requests":{
"executed" : 30,
"failed" : 0
},
"test-scripts":{
"executed" : 60,
"failed" : 0
},
"prerequest-scripts":{
"executed" : 38,
"failed" : 0
},
"assertions":{
"executed" : 60,
"failed" : 0
},
"total run duration": "8.9s"
"total data received": "8.19kB (approx)"
"average response time": "267ms"
}
有人能帮我一下吗?
1条答案
按热度按时间syqv5f0l1#
给定 exact 字符串:
您可以使用这个ruby:
图纸: