I want to save JSON file of more than 10000 chars and use it to create a list/table

I have a router API which I call and get JSON it is about 10000 chars long, because of that I am not able to load it in sensor or input text. Should I save it in a json file and then load it from there for showing on dashboards.

I cannot use REST Integration because, the login creates and session, and in that session only the requests can be processed. So, that is not possible.

the JSON I get

[{“mac”: “11-11-11-11-11-11”, “name”: “Device 1”, “hostName”: “Device1”, “deviceType”: “unknown”, “ip”: “192.17.0.1”, “connectType”: 2, “connectDevType”: “gateway”, “connectedToWirelessRouter”: “False”, “wireless”: “False”, “healthScore”: -1, “gatewayMac”: “99-99-99-99-99-99”, “gatewayName”: “TP-Link Router”, “vid”: 1, “networkName”: “LAN”, “activity”: 374, “trafficDown”: 138956491, “trafficUp”: 224513390, “uptime”: 423235, “lastSeen”: 1697041545720, “authStatus”: 0, “guest”: “False”, “active”: “True”, “manager”: “False”, “downPacket”: 1896115, “upPacket”: 2099631}, {“mac”: “22-22-22-22-22-22”, “name”: “Device 2”, “hostName”: “–”, “deviceType”: “unknown”, “ip”: “192.17.0.2”, “connectType”: 2, “connectDevType”: “gateway”, “connectedToWirelessRouter”: “False”, “wireless”: “False”, “healthScore”: -1, “gatewayMac”: “99-99-99-99-99-99”, “gatewayName”: “TP-Link Router”, “vid”: 1, “networkName”: “LAN”, “activity”: 1, “trafficDown”: 935582, “trafficUp”: 5813543, “uptime”: 423245, “lastSeen”: 1697041545720, “authStatus”: 0, “guest”: “False”, “active”: “True”, “manager”: “False”, “downPacket”: 17727, “upPacket”: 67941}]

Not sure about the method you use but you should be able to add this as an attribute, indeed not in the state.
Alternative (not sure again) you can run a curl and pipe the output through JQ to filter out only those elements/attribs you need.

1 Like

Have you tried the rest integration?

I forgot to mention that I cannot use rest Integration because the login creates a session, and only the requests can be processed in that session. So, that is not possible.

Even If I try taking limited attributes, I have around 40 devices connected, even If I take the name, mac-address,authStatus for all 40 devices, it will be exceeding 255 chars

Yes… hence I mentioned as an attribut, not in the state, the attribute can hold a lot more and starts ‘warning’ as from 16384 bytes

1 Like

Not sure if feasible then but write the json to file and use rest (or curl + jq) to read the stuff as attributes

EDIT: by any chance no existing integration that allows you to connect and get the devices out?

I was able to assign the json to attributes. Thanks for the help