• Products
    • Isadora
    • Get It
    • ADD-ONS
    • IzzyCast
    • Get It
  • Forum
  • Help
  • Werkstatt
  • Newsletter
  • Impressum
  • Dsgvo
  • Press
  • Isadora
  • Get It
  • ADD-ONS
  • IzzyCast
  • Get It
  • Press
  • Dsgvo
  • Impressum

Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags

    [ANSWERED] Parsing a text string with TCP In Watcher - Text

    Interfacing
    2
    8
    1419
    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.
    • agentsimon2
      agentsimon2 last edited by Woland

      Re: [TCP Actors & REST Interface to Database (Neo4j)](/topic/751/tcp-actors-rest-interface-to-database-neo4j)

      I am receiving a text string 

      {"status":"success","data":{"city":"Da Nang","state":"Da Nang","country":"Vietnam","location":{"type":"Point","coordinates":[108.207097,16.048587]},"current":{"weather":{"ts":"2020-04-05T06:00:00.000Z","tp":31,"pr":1014,"hu":58,"ws":3.1,"wd":110,"ic":"02d"},"pollution":{"ts":"2020-04-05T06:00:00.000Z","aqius":38,"mainus":"p2","aqicn":13,"maincn":"p2"}}}}
      and wish to parse to down to the number after "aqius":
      

      My attempt is not working! I am using msg:string={00-FF} which gets the full string but when I use msg : string = [aqius":] "," output:string={00-FF} I get nothing printed from the msg outout of the TCP In Watcher-Text
      Simon

      Running: Victus HP 16 AMD Ryzen 5 with NVIDIA RTX3050 Ti | Windows 114 | located in Da Nang, Vietnam.
      Github https://github.com/agentsimon

      bonemap 1 Reply Last reply Reply Quote 0
      • bonemap
        bonemap Izzy Guru @agentsimon2 last edited by

        @agentsimon2 said:

        I am receiving a text string 

         You will be able to use the parsing module made available a couple of weeks ago here:

        https://community.troikatronix.com/topic/6503/json-parser-actor-for-macos-and-windows-public-beta

        Kind Regards

        Russell

        http://bonemap.com | Australia
        Izzy STD 4.2 | USB 3.6 | + Beta
        MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.5 Sonoma
        Mac Studio 2023 M2 Ultra 128GB | OSX 15.3 Sequoia
        A range of deployable older Macs

        agentsimon2 1 Reply Last reply Reply Quote 1
        • agentsimon2
          agentsimon2 @bonemap last edited by

          @bonemap wow..that is perfect. Thanks

          Running: Victus HP 16 AMD Ryzen 5 with NVIDIA RTX3050 Ti | Windows 114 | located in Da Nang, Vietnam.
          Github https://github.com/agentsimon

          1 Reply Last reply Reply Quote 2
          • agentsimon2
            agentsimon2 last edited by

            ohh so I have been trying to parse something from thingsspeak.com and it returns this

            {"channel":{"id":1035630,"name":"RSSI","description":"RSSI value","latitude":"0.0","longitude":"0.0","field1":"rssi","created_at":"2020-04-11T09:56:53Z","updated_at":"2020-04-11T10:27:34Z","last_entry_id":31},
            "feeds":[{"created_at":"2020-04-11T11:37:00Z","entry_id":30,"field1":"-36"},{"created_at":"2020-04-11T11:51:04Z","entry_id":31,"field1":"-42"}]}
            

            How do I get this out of the returned string? It's in some square brackets and I just can not work out how to do it!

            "field1":"-42"

            Running: Victus HP 16 AMD Ryzen 5 with NVIDIA RTX3050 Ti | Windows 114 | located in Da Nang, Vietnam.
            Github https://github.com/agentsimon

            1 Reply Last reply Reply Quote 0
            • bonemap
              bonemap Izzy Guru last edited by bonemap

              @agentsimon2 said:

              get this out of the returned string


              JSON-Demo-bonemap.izz

              Best Wishes

              Russell

              http://bonemap.com | Australia
              Izzy STD 4.2 | USB 3.6 | + Beta
              MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.5 Sonoma
              Mac Studio 2023 M2 Ultra 128GB | OSX 15.3 Sequoia
              A range of deployable older Macs

              1 Reply Last reply Reply Quote 0
              • agentsimon2
                agentsimon2 last edited by

                ok but when I add the Get Text to the json in on the first parser it fails.. I got round it by adding a text chopper.

                rssi.izz

                PS I'll delete the API key later

                Running: Victus HP 16 AMD Ryzen 5 with NVIDIA RTX3050 Ti | Windows 114 | located in Da Nang, Vietnam.
                Github https://github.com/agentsimon

                bonemap 1 Reply Last reply Reply Quote 1
                • bonemap
                  bonemap Izzy Guru @agentsimon2 last edited by bonemap

                  @agentsimon2

                  I had a second look at your patch. It actually works! We just have to remember that arrays in javascript start at '0' -


                  GetURL with Array.izz

                  best wishes Russell

                  http://bonemap.com | Australia
                  Izzy STD 4.2 | USB 3.6 | + Beta
                  MBP 16” 2019 2.4 GHz Intel i9 64GB AMD Radeon Pro 5500 8 GB 4TB SSD | 14.5 Sonoma
                  Mac Studio 2023 M2 Ultra 128GB | OSX 15.3 Sequoia
                  A range of deployable older Macs

                  1 Reply Last reply Reply Quote 0
                  • agentsimon2
                    agentsimon2 last edited by

                    ahh I didn't know that...so it's an array whose first element is referenced as 0. I see that the number of elements returned by the URL can be changed so it's possible to collect, say the last 10 values posted to Thingsspeak. Now I can do some statistics on the data, calculate highest/lowest, the mean, rate of change...interesting..the stats could be used to trigger events in a performance.

                    thanks again Simon

                    Running: Victus HP 16 AMD Ryzen 5 with NVIDIA RTX3050 Ti | Windows 114 | located in Da Nang, Vietnam.
                    Github https://github.com/agentsimon

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