• 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] JSON Parser Beta and nested square brackets

    How To... ?
    json parser
    5
    15
    2905
    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.
    • mark
      mark @Fred last edited by mark

      @fred said:

      I have made a javascript actor to parse the timestamps and output a human readable date time string. However the timestamps I am getting are in milliseconds and are truncated by the limitation of the type I am guessing (I think they should be int64?).

      According to this article about Javascript integers:

      JavaScript, by specification, does not know about integers (with the exception of recently introduced BigInts). It only knows IEEE doubles. But many operations are based on integers, just think of for loops. All JavaScript engines have a special representation for integers. V8 has so called Smis, small integers.

      Now, I just tried using a BigInt in our Javascript actor -- but it ended up crashing Isadora. :-(

      (Apparently our version of v8 knows about BigInts because I didn't get a syntax error, but something else went wrong. I'll have to look into that.)

      Let me get clear on what you mean by "unix timestamps" -- do you mean the number of seconds since midnight Jan 1, 1970? I guess not since these do not include milliseconds. What do you mean?

      But what if you simply divided your millisecond integer values by 1000.0 to get seconds instead? Does that address the problem?

      Well, I think I need an example patch or something to answer this more effectively.

      Best Wishes,
      Mark

      Media Artist & Creator of Isadora
      Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

      Fred 1 Reply Last reply Reply Quote 1
      • Fred
        Fred @mark last edited by

        @mark yes, I am talking about unix timestamps - the number of seconds since midnight Jan 1, 1970, this is how pretty much every web api deals with dates and times. The problem I am having is not getting the timestamp into the Javascript actor but getting it out of the JSON parser.

        For example when I check the web api I am using I get the first timestamp as : 1585207161600, but this element is output from the JSON parser as 364071376, if I use another method to see the results and search them there is nowhere that I find 364071376 (just to check if I made a mistake parsing).

        I have made a very simple sample patch based on the example above, if I change any of the values of a JSON attribute to 1585207161600, it will output 364071376 from the parser.JSON Parse timestamp error.izz

        http://www.fredrodrigues.net/
        https://github.com/fred-dev
        OSX 13.6.4 (22G513) MBP 2019 16" 2.3 GHz 8-Core i9, Radeon Pro 5500M 8 GB, 32g RAM
        Windows 10 7700K, GTX 1080ti, 32g RAM, 2tb raided SSD

        Fred 1 Reply Last reply Reply Quote 1
        • Fred
          Fred @Fred last edited by

          @mark Any word on this or should I put it in a bug report- I understand this might not be high priority.

          http://www.fredrodrigues.net/
          https://github.com/fred-dev
          OSX 13.6.4 (22G513) MBP 2019 16" 2.3 GHz 8-Core i9, Radeon Pro 5500M 8 GB, 32g RAM
          Windows 10 7700K, GTX 1080ti, 32g RAM, 2tb raided SSD

          DusX 1 Reply Last reply Reply Quote 0
          • DusX
            DusX Tech Staff @Fred last edited by

            @fred

            I've confirmed the issue, and have added it to the issue tracker.
            Thanks

            Troikatronix Technical Support

            • New Support Ticket Link: https://support.troikatronix.com/support/tickets/new
            • My Add-ons: https://troikatronix.com/add-ons/?u=dusx
            • Profession Services: https://support.troikatronix.com/support/solutions/articles/13000109444-professional-services

            Running: Win 11 64bit, i7, M.2 PCIe SSD's, 32gb DDR4, nVidia GTX 4070 | located in Ontario Canada.

            Fred 1 Reply Last reply Reply Quote 0
            • Fred
              Fred @DusX last edited by

              @dusx cheers

              http://www.fredrodrigues.net/
              https://github.com/fred-dev
              OSX 13.6.4 (22G513) MBP 2019 16" 2.3 GHz 8-Core i9, Radeon Pro 5500M 8 GB, 32g RAM
              Windows 10 7700K, GTX 1080ti, 32g RAM, 2tb raided SSD

              mark 1 Reply Last reply Reply Quote 0
              • mark
                mark @Fred last edited by

                @fred

                I believe JSON Parser v0.9.3 addressees your problem. Please give it a try. (Note: you'll need to change the text inputs to see the correct results; simply opening a patch will not generate a new output because the input string will not have changed.)

                json-parser-v0.9.3.zip

                Best Wishes,
                Mark

                Media Artist & Creator of Isadora
                Macintosh SE-30, 32 Mb RAM, MacOS 7.6, Dual Floppy Drives

                Fred 2 Replies Last reply Reply Quote 2
                • Fred
                  Fred @mark last edited by

                  @mark works like a charm thanks.

                  http://www.fredrodrigues.net/
                  https://github.com/fred-dev
                  OSX 13.6.4 (22G513) MBP 2019 16" 2.3 GHz 8-Core i9, Radeon Pro 5500M 8 GB, 32g RAM
                  Windows 10 7700K, GTX 1080ti, 32g RAM, 2tb raided SSD

                  1 Reply Last reply Reply Quote 0
                  • Fred
                    Fred @mark last edited by

                    @mark here is what I was trying to do, it now works great, and I made a little javascript to get human readable dates and times from timestamps. This will get earthquake data from a selected time period and read out timestamps locations magnitude and latitude and longitude and display it on screen. I am a bit busy now but I was hoping to find a way to rotate a globe map to the latitude and longitude of each earthquake if anyone knows how..

                    The data comes from the US government and this site: https://www.usgs.gov/products/data-and-tools/real-time-data/earthquakes

                    Patch attached

                    Fred

                    Earthquake report.izz

                    http://www.fredrodrigues.net/
                    https://github.com/fred-dev
                    OSX 13.6.4 (22G513) MBP 2019 16" 2.3 GHz 8-Core i9, Radeon Pro 5500M 8 GB, 32g RAM
                    Windows 10 7700K, GTX 1080ti, 32g RAM, 2tb raided SSD

                    Michel bonemap 2 Replies Last reply Reply Quote 0
                    • Michel
                      Michel Izzy Guru @Fred last edited by

                      @fred

                      I was hoping to find a way to rotate a globe map to the latitude and longitude of each earthquake if anyone knows how..

                      Download the files from the Gurusession #3 (https://support.troikatronix.c...).  @mark has a scene there that does exactly that.

                      Best Michel

                      Michel Weber | www.filmprojekt.ch | rMBP (2019) i9, 16gig, AMD 5500M 8 GB, OS X 10.15 | located in Winterthur Switzerland.

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

                        @fred said:

                        a way to rotate a globe map to the latitude and longitude of each earthquake if anyone knows how..

                         @Michel is right you will find a javascript actor in the demo patch from @mark. It transforms latitude and longitude to quaternion angles that can be applied to move a sphere. I have used it in a patch with open source data from World Bank that indicates poverty levels / relative wealth in 180 countries. Interestingly, Marks example demos states in the USA. But I applied the effect on global positions. I guess in controlled visual simulations motion paths might be more like actual flight paths rather than direct and uncanny routes. When we see the earth move/spin it is usually constrained by the magnetic poles. I haven’t yet built in any constraints to simulate this.

                        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

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

                          @Fred 

                          Here is the demonstration patch I am working on - not even close to completed. I have reduced the resolution of the texture maps to fit into under 3mb download .zip.

                          You will see the javascript actor from @mark that rotates the sphere (it references an external three.js file that needs to be accessible in the project folder). I haven't yet completed calibrating the rotation to be absolutely accurate with the texture map, but it is in the general location of cities that are referenced through the World Bank API.

                          It uses API data sources from VirusTracker and the WorldBank. I am also looking at accessing earth texture maps from NASA API to associate with times of day. but at the moment just have two texture maps that swap out including an example of average temperature and night. The data updates every day based on the availability of current Covid19 statistics through VirusTracker. It is set to minus 3 days because of the uncertainty of availability of daily data over weekends etc. The WorldBank API data provides, country broad individual wealth position, world coordinates and capital city.

                          I would say the patch system needs a way to capture the data with a single pass of the API URL's rather than continuously using the TCP GET method over and over. I haven't yet got the single pass TCP GET method into a Data Array configured, but I think that would be best practice.

                          DataSphere 2.zip

                          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

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