MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Get the correct JSON data

    Scheduled Pinned Locked Moved Development
    15 Posts 2 Posters 1.7k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @htilburgs
      last edited by

      @htilburgs is it separate api calls to get each different data collection?

      or still one call?

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      htilburgsH 1 Reply Last reply Reply Quote 0
      • htilburgsH Offline
        htilburgs @sdetweil
        last edited by

        @sdetweil
        One calll, here you can see (demo data)
        https://weerlive.nl/api/weerlive_api_v2.php?key=demo&locatie=Amsterdam

        (still trying to learn JS, but not afraid to ask) ☺

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @htilburgs
          last edited by

          @htilburgs you can set a variable to the array locations and not move the data. of course the data element names may have changed , but that is an editor find/replace function

          send the whole response up to the module

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          htilburgsH 1 Reply Last reply Reply Quote 0
          • htilburgsH Offline
            htilburgs @sdetweil
            last edited by

            @sdetweil
            As I told you I have to figure out how. I always have problems with understanding how JSON works. But no problem, it keeps me of the streets.
            I haven’t been active for the last 3 years, but now I’ve found time and trying to complete / change some modules.
            But thanks for you help.

            (still trying to learn JS, but not afraid to ask) ☺

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @htilburgs
              last edited by

              @htilburgs

              let foovar = payload.liveweer[0]

              then you can use foovar to reference the data

              json is just a text description of an object
              it coverts directly into js with the same structure

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              htilburgsH 2 Replies Last reply Reply Quote 0
              • htilburgsH Offline
                htilburgs @sdetweil
                last edited by

                @sdetweil said in Get the correct JSON data:

                coverts directly into js with the same structure

                I will try tonight. I’m at work (yeh right ;-) right now.

                (still trying to learn JS, but not afraid to ask) ☺

                1 Reply Last reply Reply Quote 0
                • htilburgsH Offline
                  htilburgs @sdetweil
                  last edited by

                  @sdetweil said in Get the correct JSON data:

                  let foovar = payload.liveweer[0]

                  Is there a simple way to check what is in foovar?

                  (still trying to learn JS, but not afraid to ask) ☺

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @htilburgs
                    last edited by

                    @htilburgs console.log() same as before, BUT it is displayed in the developers window console table when its in the browser side module.js (modulename.js)

                    ctrl-shift-i, select the console tab

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    htilburgsH 1 Reply Last reply Reply Quote 0
                    • htilburgsH Offline
                      htilburgs @sdetweil
                      last edited by

                      @sdetweil Thanks, that works!
                      Now I can really see what I’m doing.

                      (still trying to learn JS, but not afraid to ask) ☺

                      1 Reply Last reply Reply Quote 1
                      • 1
                      • 2
                      • 2 / 2
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy