Streaming JSON data into Max


    Leviticus's icon
    Leviticus's icon
    Aug 20 2013 | 4:42 pm
    So I have some data within a JSON package that I'd like to stream into Max. I then intend to manipulate the data in Max. Are there any objects that enable this? If not, does any body have any suggestions as to how to go about achieving this?

    • mzed's icon
      mzed's icon
      Aug 20 2013 | 5:11 pm
      I just did this in a very brute-force way; reading through the file line-by-line and unpacking/parsing. That was lame, I wouldn't recommend it.
      JavaScript is the obvious solution; I'll see if I can put that together.
    • mzed's icon
      mzed's icon
      Aug 20 2013 | 5:31 pm
      Something like this should work: outlets=1;
      function readlines(s) { var f = new File(s); var i,a,c;
      if (f.isopen) { i=0; while ((a=f.readline()) && i var parsed = JSON.parse(a); outlet(0, + " " + parsed.value); i++; } f.close(); } else { post("could not open file: " + s + "\n"); } }
    • oli larkin's icon
      oli larkin's icon
      oli larkin
      Aug 20 2013 | 5:58 pm
      some json parsing here:
      i used some 3rd party code. not sure if that is no longer needed in max6
    • Lee's icon
      Lee's icon
      Aug 20 2013 | 8:16 pm
      The [dict] object can read and write json files...
    • anomalous's icon
      anomalous's icon
      Jan 10 2014 | 11:00 am
      Hi mzed - re: your post on putting together a way to use javascript for reading json data - have you made anything that can do this yet or should i use the [dict] object as suggested at the end of this thread?
      thanks anom
    • Hidde's icon
      Hidde's icon
      Jan 10 2014 | 1:14 pm
      Using the dict object with Javascript can probably do everything you want. There's a lot of information in the documentation and on the forums.
    • leapformax's icon
      leapformax's icon
      Sep 22 2014 | 9:14 pm
      This is solved with different approaches now, choose yours. Password for file is "noleak" As available on
    • leapformax's icon
      leapformax's icon
      Sep 22 2014 | 9:22 pm
      OK here without windows node setup batch, so that forum security is ok. No more password is needed, especially if you are not interested in the nodejs part of the solution.
    • leapformax's icon
      leapformax's icon
      Sep 23 2014 | 8:49 pm
      The website got updated! The setup pages are greatly simplified There is the preview of the webdemo :-)
      In your case you only care about tcpigola, ignore node and tcpigolo. This will work untill you have somthing sending ascii encoded JSON via udp to your max.