GithubHelp home page GithubHelp logo

kblankenship1989 / mmm-json-feed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amcolash/mmm-json-feed

0.0 1.0 0.0 39 KB

A MagicMirror module that displays information from any json source

License: MIT License

JavaScript 98.87% CSS 1.13%

mmm-json-feed's Introduction

MMM-json-feed

A MagicMirror module that displays information from any json source

status

This code is partially copied from the very simple stock ticker from @alexyak.

Notice: I have no intention of adding new features to the code here. Multiple people have asked for more customized features. If you are interested in something cool and awesome that isn't implemented, let me know and if I do get time I may be able to help. A small donation to the beer/coffee fund never hurts (paypal: [email protected]) to show your appreciation (by no means required)! I love open source software and love providing time to my projects, but I don't use this module so it is not high on my list of things to do. As always, if you make modifications start a PR and we can merge it into the master branch.

What it Looks Like!

Nothing too pretty, just the data you want to see :)

There are some config options to make the json keys a bit prettier though, mentioned below in the config.

Screenshot

Here is the above json example data:

{
  "andrewMcolash":true,
  "AndrewMc":"123",
  "test_this":["a","b","c"],
  "Test_This":{"e":true,"f":"abc"}
}

Install

cd MagicMirror/modules git clone https://github.com/amcolash/MMM-json-feed.git

Update

cd MagicMirror/modules/MMM-json-feed git pull

Configuration

It is very simple to set up this module, a sample configuration looks like this:

modules: [
  {
    module: 'MMM-json-feed',
    position: 'bottom_bar',
    config: {
      urls: [
        'http://your.server.json.here/abc1.json',
        'http://your.server.json.here/abc2.json',
      ]
    }
  }
]

Configuration Options

Option Description
prettyName Pretty print the name of each JSON key (remove camelCase and underscores).

Default value: true
stripName Removes all keys before the printed key.

Example: a.b.c will print c.
Default value: true
title Title to display at the top of the module.

Default value: JSON Feed
urls An array of urls for your json feeds. Note that duplicate keys WILL be clobbered.

Default value: REQUIRED
url DEPRECATED, Please use urls instead.
The url of the json feed.
Default value: REQUIRED
updateInterval The time between updates (In milliseconds).

Default value: 300000 (5 minutes)
singleLine Display all values on a single line.

Default value: false
values Specify specific values from the json feed to only show what you need.

Example: ["key1", "key2", "keyA.keyB.keyC"]
Default value: [] (Shows all keys in the object)
arrayName Name of array of items to iterate through.

Default value: undefined
arraySize Number of array of items to show.

Default value: 999
replaceName Specify key names to replace in the json. This is an array of arrays [find, replace]

Example: [ ["body", "replaced body"], ["id", "replacedID"] ]

Using an Array of Data and Custom Parsing

You can use the new config arrayName to parse through an array and then add parts from each object.

For the given json:

{
  messages: [
    { name: "a", id: 1, somethingElse: false },
    { name: "b", id: 2, somethingElse: false },
    { name: "c", id: 3, somethingElse: true }
  ]
}

you could have in your config (to show only the parts you care about and limit to 5 entries):

config: {
  ...
  arrayName: "messages",
  arraySize: 5,
  values: [ "name", "id" ]
}

mmm-json-feed's People

Contributors

amcolash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.