timdows / MMM-JsonTable

A module for the MagicMirror project which creates a table filled with a list gathered from a json request.
MIT License
25 stars 31 forks source link

Json type is not an array error #17

Open wirelessphreak opened 3 years ago

wirelessphreak commented 3 years ago

I apologize is this is an obvious issue, I am sort of a coding rookie. I am running an icecast server and I wanted to leverage your module to show currently playing tracks on my magic mirror. I dont feel the icecast server provides the best formatted json hence not correctly identifying an array parameter. I was curious if you could point me in the right direction to get your Module to display the currently playing track. it is the title: nested in the Json response. Thanks you for your wonderful module.

Here is the json output. { "icestats": { "admin": "host@local.com", "host": "radio.phreakn.tel", "location": "Earth", "server_id": "Icecast 2.4.4", "server_start": "Mon, 21 Dec 2020 02:41:56 -0500", "server_start_iso8601": "2020-12-21T02:41:56-0500", "source": { "genre": "Science and Technology", "listener_peak": 4, "listeners": 0, "listenurl": "http://radio.station.com:8000/stream", "server_description": "Defcon talks and live performaces", "server_name": "WirelessPhreak Radio", "server_type": "audio/mpeg", "server_url": "https://www.wirelessphreak.com", "stream_start": "Thu, 24 Dec 2020 19:40:44 -0500", "stream_start_iso8601": "2020-12-24T19:40:44-0500", "title": "DEF_CON_SafeMode-_Shadowvex", "dummy": null } } }

timdows commented 3 years ago

Sorry for the late response. Did you solve the issue?

If not, what is your config look like? And is there any information indicating an error in the console?

TobSand commented 2 years ago

Hi, think I have the same issue. My Json output does not contain an array parameter. That's my Json output:

{ "header":{ "namespace":"Device", "name":"Response", "messageId":"73C6C007-A870550C", "payloadVersion":"1", "authorization":"B8F007A13B64-0011EFC8" }, "payload":{ "measure":{ "level":0.13, "content":329 }, "expansion":{ "boardType":-1, "oneWire":null, "board":null }, "device":{ "firmware":"1.50", "hardware":"B5", "name":"Liquid-Check", "model":{ "name":"", "number":1 }, "manufacturer":"SI-Elektronik GmbH", "uuid":"0ba6f4a0c-7a88b1968-0001", "security":{ "code":"qSazcj4exZq3gjxq6zQKXQdjw==" } }, "system":{ "error":0, "uptime":1568708, "pump":{ "totalRuns":30, "totalRuntime":78 } }, "wifi":{ "station":{ "hostname":"Liquid-Check", "ip":"192.168.178.89", "gateway":"192.168.178.1", "netmask":"255.255.255.0", "mac":"B8:F4:02:A1:3A:54" }, "accessPoint":{ "ssid":"FRITZ!Box", "bssid":"75:42:8F:C7:6F:B9", "rssi":-81 } } } }

I just want to display the values of "level" and "content" (in "payload":{"measure":{"level":0.13,"content":329}, ). I tried several thinks but unfortunately it doesn't work (seems that my programming skills reached the end).

Hope you can help or offering advice!!!

Best regards