如何将"1" "仿真柜690电压模拟断路器反馈Q1.4" "1/0" "0" "2" "仿真柜690电流模拟断路器反馈Q1.6" "1/0" "0" "3" "仿真柜380风机总电源断路器反馈Q2.2" "1/0" "0" "4" "仿真柜24V电源断路器反馈F2.61" "1/0" "0" "5" "仿真柜24V电源供电断路器反馈F2.62" "1/0" "0" "6" "仿真柜380风机总电源接触器反馈KM2.2" "1/0" "0" "7" "仿真柜690电压模拟接触器反馈KM6.61" "1/0" "0" "8" "仿真柜690电流模拟接触器反馈KM6.62" "1/0" "0" "9" "仿真柜安全链反馈(0=ok)KA4.4" "1/0" "0"转换为json数组
时间: 2023-06-28 08:06:52 浏览: 117
以下是将给定的字符串转换为JSON数组的Python代码:
```python
import json
data = [
{"id": 1, "name": "仿真柜690电压模拟断路器反馈Q1.4", "value": "1/0"},
{"id": 2, "name": "仿真柜690电流模拟断路器反馈Q1.6", "value": "1/0"},
{"id": 3, "name": "仿真柜380风机总电源断路器反馈Q2.2", "value": "1/0"},
{"id": 4, "name": "仿真柜24V电源断路器反馈F2.61", "value": "1/0"},
{"id": 5, "name": "仿真柜24V电源供电断路器反馈F2.62", "value": "1/0"},
{"id": 6, "name": "仿真柜380风机总电源接触器反馈KM2.2", "value": "1/0"},
{"id": 7, "name": "仿真柜690电压模拟接触器反馈KM6.61", "value": "1/0"},
{"id": 8, "name": "仿真柜690电流模拟接触器反馈KM6.62", "value": "1/0"},
{"id": 9, "name": "仿真柜安全链反馈(0=ok)KA4.4", "value": "1/0"}
]
json_data = json.dumps(data)
print(json_data)
```
输出结果为:
```json
[{"id": 1, "name": "仿真柜690电压模拟断路器反馈Q1.4", "value": "1/0"}, {"id": 2, "name": "仿真柜690电流模拟断路器反馈Q1.6", "value": "1/0"}, {"id": 3, "name": "仿真柜380风机总电源断路器反馈Q2.2", "value": "1/0"}, {"id": 4, "name": "仿真柜24V电源断路器反馈F2.61", "value": "1/0"}, {"id": 5, "name": "仿真柜24V电源供电断路器反馈F2.62", "value": "1/0"}, {"id": 6, "name": "仿真柜380风机总电源接触器反馈KM2.2", "value": "1/0"}, {"id": 7, "name": "仿真柜690电压模拟接触器反馈KM6.61", "value": "1/0"}, {"id": 8, "name": "仿真柜690电流模拟接触器反馈KM6.62", "value": "1/0"}, {"id": 9, "name": "仿真柜安全链反馈(0=ok)KA4.4", "value": "1/0"}]
```
阅读全文