• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Some sort of JSON interpretation problem in newsfeed module

Scheduled Pinned Locked Moved Unsolved Troubleshooting
5 Posts 2 Posters 634 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.
  • F Offline
    fribse
    last edited by Aug 29, 2021, 12:56 PM

    I’ve been struggling with an external compliments file for some time, and after another user posted his on gist, I took the liberty to use that as a test, and then compared the two.

    I couldn’t get mine to work at all, but the other worked fine.
    By changing the indentation to three spaces, it worked. It was two spaces.
    This is a really odd problem, there is no standard to my knowledge for JSON that sets it at specific three spaces?

    So this didn’t work:

    {
       "anytime" : [
          "Jeg beundrer,\nat du altid er helt dig selv",
          "Man bliver så glad af\nat være sammen med dig",
    ...
    

    But this does

    {
        "anytime" : [
            "Jeg beundrer,\nat du altid er helt dig selv",
            "Man bliver så glad af\nat være sammen med dig",
    ...
    

    I think that is really odd.

    Furthermore I had to remember the quotes around the key, which isn’t needed in the internal list, but if I read it right, it must have quotes in a proper json file.

    S 2 Replies Last reply Aug 29, 2021, 1:02 PM Reply Quote 0
    • S Away
      sdetweil @fribse
      last edited by sdetweil Aug 29, 2021, 1:07 PM Aug 29, 2021, 1:02 PM

      @fribse all things must be quoted in json, JavaScript only the right side of : needs quoting

      I use an online JSON validator to check my JSON files. this is my go-to
      https://codebeautify.org/jsonvalidator?/jsonvalidate
      click the top left corner and it will format the content. great for understanding API returns

      I have never seen spaces make a difference

      maybe there is a tab in there?

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 1
      • S Away
        sdetweil @fribse
        last edited by Aug 29, 2021, 1:06 PM

        @fribse u could also copy the default from the doc, or the module source too

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        F 1 Reply Last reply Sep 2, 2021, 4:33 PM Reply Quote 0
        • F Offline
          fribse @sdetweil
          last edited by Sep 2, 2021, 4:33 PM

          @sdetweil Hey Sam

          I only wrote the thing with the quotes as the internal config seems to be a bit more leniant.
          No tabs, the ONLY thing I did to make it work, was add an extra space :-)
          My config is so old by now, that every time I look at it, I have to rethink everything to get to the same result :-D

          S 1 Reply Last reply Sep 2, 2021, 6:54 PM Reply Quote 0
          • S Away
            sdetweil @fribse
            last edited by Sep 2, 2021, 6:54 PM

            @fribse if u run it thru the validator, does it work?

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              1/5
              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