Read the statement by Michael Teeuw here.
Display JSON data from an api
-
You could take a look at the MMM-Rest… It doesnt have the ability to read json but could be modified. If you do modify it to accept json, please let me know as I am also looking for a way to do this.
https://forum.magicmirror.builders/topic/1851/mmm-rest-reading-json
-
@mortenbirkelund it would be easier to just write a new module for it… hacking something will probably not give you the results you want.
What is the address of the api?
-
Thanks, yes. Do you happen to know of a module that successfully loads data from a JSON file? Seems like such a simple thing to do.
and @mortenbirkelund
Thanks for the suggestion. I don’t have the skills to make this, yet. -
@cowboysdude said in Display JSON data from an api:
it would be easier to just write a new module for it…
Perhaps. I just guessed a the rest module could be a good starting point.
-
@looolz Where is the info coming from? What is the api address?
-
@cowboysdude There is no API. In this case it’s just shell scripts that write out JSON files. I could modify the shell script to write out the files anyhow I want.
-
So this is just a JSON file which is sitting on your raspberry, right?
The approach would be the same as with the compliments.js module loading a local file with additional statements.
That shouldn’t be too difficult. I could try to tackle this, but I need to complete another module first which is waiting for so long already … too much to do and no time :( -
@yawns Thanks for the reply!
Well, the JSON-file would be hosted on a server, so a http-path to the file would do the job for sure. A common way to do this that I’ve seen is installing Dropbox on a server, and sharing out the JSON file via a public link.
-
@looolz I am actually trying to do this also. I have JSON data I’m pulling from an API and am able to present it on a page when I click a button but am not entirely sure how to map this over to an actual MM2 module. I’m trying to follow the documentation and it’s overwhelming for someone with limited JS experience! Is there a generic module already created which can be used to kind of re-point the URL to use any JSON feed, change the returned field names and obviously update the results on the mirror?
-
:D
I just noticed @PeppaPigKilla was the one asking for a UbisoftStats display and @looolz was asking for some different usecase@looolz: do you have an example of your JSON file?