Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. verschachteltes json auflösen in Blockly [gelöst]

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    verschachteltes json auflösen in Blockly [gelöst]

    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jr28 last edited by jr28

      leider jagt ein Problem das andere:

      wie kann ein solches json in Blockly ausgewertet werden?

      {
         "destination_addresses" : [ "Talstraße 52, 66424 Homburg, Deutschland" ],
         "origin_addresses" : [ "Spitalstraße 75, 66564 Ottweiler, Deutschland" ],
         "rows" : [
            {
               "elements" : [
                  {
                     "distance" : {
                        "text" : "21,6 km",
                        "value" : 21566
                     },
                     "duration" : {
                        "text" : "25 Minuten",
                        "value" : 1470
                     },
                     "status" : "OK"
                  }
               ]
            }
         ],
         "status" : "OK"
      }
      

      ich brauche den Wert "duration" - "value" also hier die 1470

      geht das überhaupt in Blockly oder nur in Javascript?

      das Kapitel "rows" kann ich noch trennen, dann scheitere ich an der eckigen Klammer die das nächste (Unter-) Kapitel umfasst.

      Homoran 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @jr28 last edited by Homoran

        @jr28 hab das mal in code-tags gesetzt.

        müsste Attribut von rows.elements.duration.value sein.
        musst du aber nochmal testen

        edit: oder rows.0.elements.0.duration.value

        J 1 Reply Last reply Reply Quote 0
        • J
          jr28 @Homoran last edited by

          @homoran said in verschachteltes json auflösen in Blockly:

          rows.0.elements.0.duration.value

          Bingo, das war es.

          Heißt das dann wie folgt:

          Immer wenn eine Verschachtelung kommt ist ein "." zu setzen und, wenn zusätzlich eckige Klammern kommen auch noch eine "0." ???

          1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators last edited by

            @jr28 sagte in verschachteltes json auflösen in Blockly:

            wenn zusätzlich eckige Klammern kommen auch noch eine "0." ???

            oder eine 1, 2...
            je nachdem welches Feld des Arrays das ist

            der hier hat es mir verraten
            Screenshot_20221122-174640_Firefox.jpg

            J 1 Reply Last reply Reply Quote 0
            • J
              jr28 @Homoran last edited by

              @homoran

              vielen Dank, ein super Tool. Werde ich mir merken.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              770
              Online

              32.0k
              Users

              80.5k
              Topics

              1.3m
              Posts

              2
              5
              280
              Loading More Posts
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes
              Reply
              • Reply as topic
              Log in to reply
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              The ioBroker Community 2014-2023
              logo