Streaming JSON data into Max

Aug 20, 2013 at 9:42am

Streaming JSON data into Max


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?


Aug 20, 2013 at 10:11am

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.

Aug 20, 2013 at 10:31am

Something like this should work:

function readlines(s)
var f = new File(s);
var i,a,c;

if (f.isopen) {
while ((a=f.readline()) && i<10) { // returns a string
var parsed = JSON.parse(a);
outlet(0, + " " + parsed.value);
} else {
post("could not open file: " + s + "\n");

Aug 20, 2013 at 10:58am

some json parsing here:

i used some 3rd party code. not sure if that is no longer needed in max6

Aug 20, 2013 at 1:16pm

The [dict] object can read and write json files…

Jan 10, 2014 at 3:00am

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

Jan 10, 2014 at 5:14am

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.


You must be logged in to reply to this topic.