C# 分析複雜JSON(controllers)過程紀錄 [json to class / json 2 class Tool網站]
C# 分析複雜JSON(controllers)過程紀錄 [json to class / json 2 class Tool網站]
01.資料來源:http://192.168.1.68:24410/syris/v8/controller
02.取得資訊
{“controllers”:[{“identifier”:1,”status”:{“model_code”:35090,”serial_number”:387121153,”network_identifier”:1,”door_amount”:12,”authorized_configuration_amount”:1,”is_connected”:1,”door_state”:0,”input_state”:4095,”output_state”:0},”attribute”:{“connetction_enabled”:1,”connetction_mode”:0,”connetction_address”:3439438016,”ab_door_enabled”:0,”ab_door_level”:1,”ab_door_timeout_second”:30,”ab_door_reset_time_second”:60,”apb_enabled”:1,”apb_group”:1,”apb_mode”:1,”apb_level_list”:[0,0,0,0,0,0,0,0,0,0,0,0],”apb_reset_timestamp_list”:[0,0,0,0,0,0,0,0],”holiday_of_months_field_flags”:[0,0,0,0,0,0,0,0,0,0,0,0]}},{“identifier”:2,”status”:{“model_code”:35106,”serial_number”:387121153,”network_identifier”:1,”door_amount”:12,”authorized_configuration_amount”:1,”is_connected”:1,”door_state”:0,”input_state”:4095,”output_state”:0},”attribute”:{“connetction_enabled”:1,”connetction_mode”:0,”connetction_address”:3456215232,”ab_door_enabled”:0,”ab_door_level”:1,”ab_door_timeout_second”:30,”ab_door_reset_time_second”:60,”apb_enabled”:1,”apb_group”:1,”apb_mode”:1,”apb_level_list”:[0,0,0,0,0,0,0,0,0,0,0,0],”apb_reset_timestamp_list”:[0,0,0,0,0,0,0,0],”holiday_of_months_field_flags”:[0,0,0,0,0,0,0,0,0,0,0,0]}}]}
03.資訊以JSON格式呈現
{
“controllers”:
[
{
“identifier”: 1,
“status”: {
“model_code”: 35090,
“serial_number”: 387121153,
“network_identifier”: 1,
“door_amount”: 12,
“authorized_configuration_amount”: 1,
“is_connected”: 1,
“door_state”: 0,
“input_state”: 4095,
“output_state”: 0
},
“attribute”: {
“connetction_enabled”: 1,
“connetction_mode”: 0,
“connetction_address”: 3439438016,
“ab_door_enabled”: 0,
“ab_door_level”: 1,
“ab_door_timeout_second”: 30,
“ab_door_reset_time_second”: 60,
“apb_enabled”: 1,
“apb_group”: 1,
“apb_mode”: 1,
“apb_level_list”: [0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0],
“apb_reset_timestamp_list”: [0,
0,
0,
0,
0,
0,
0,
0],
“holiday_of_months_field_flags”: [0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0]
}
},
{
“identifier”: 2,
“status”: {
“model_code”: 35106,
“serial_number”: 387121153,
“network_identifier”: 1,
“door_amount”: 12,
“authorized_configuration_amount”: 1,
“is_connected”: 1,
“door_state”: 0,
“input_state”: 4095,
“output_state”: 0
},
“attribute”: {
“connetction_enabled”: 1,
“connetction_mode”: 0,
“connetction_address”: 3456215232,
“ab_door_enabled”: 0,
“ab_door_level”: 1,
“ab_door_timeout_second”: 30,
“ab_door_reset_time_second”: 60,
“apb_enabled”: 1,
“apb_group”: 1,
“apb_mode”: 1,
“apb_level_list”: [0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0],
“apb_reset_timestamp_list”: [0,
0,
0,
0,
0,
0,
0,
0],
“holiday_of_months_field_flags”: [0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0]
}
}
]
}
04.分析JSON
GOOGLE查:json to c# class converter
使用http://json2csharp.com/ https://jsonutils.com/ 2者都可得到
public class Status
{
public int model_code;
public int serial_number;
public int network_identifier;
public int door_amount;
public int authorized_configuration_amount;
public int is_connected;
public int door_state;
public int input_state;
public int output_state;
}
public class Attribute
{
public int connetction_enabled;
public int connetction_mode;
public object connetction_address;
public int ab_door_enabled;
public int ab_door_level;
public int ab_door_timeout_second;
public int ab_door_reset_time_second;
public int apb_enabled;
public int apb_group;
public int apb_mode;
public List<int> apb_level_list;
public List<int> apb_reset_timestamp_list;
public List<int> holiday_of_months_field_flags;
}
public class Controller
{
public int identifier;
public Status status;
public Attribute attribute;
}
public class Controllers
{
public List<Controller> controllers;
}
4 thoughts on “C# 分析複雜JSON(controllers)過程紀錄 [json to class / json 2 class Tool網站]”
JSON 轉 C# CLASS 網站
https://www.site24x7.com/tools/json-to-csharp.html
JSON 轉 C# CLASS 網站
https://www.freecodeformat.com/json2csharp.php
JSON 轉 C# CLASS 網站
https://www.beautifyconverter.com/json-to-csharp-converter.php
JSON 轉 C# CLASS 網站
https://www.bejson.com/convert/json2csharp/