Json parser?

    MaxMSP

    gwsounddsg's icon
    gwsounddsg's icon
    gwsounddsg
    Aug 28 2013 | 3:46 am
    I am receiving over udp an osc message with a json string:
    { "uniqueID": string, "number": string "name": string "listName": string "type": string "colorName": string "flagged": number "armed": number "cues": [ { }, { }, { } ] }
    Is there an abstraction or anything that will parse this? The keys will be static if that helps.
    Thanks GW

    • Emmanuel Jourdan's icon
      Emmanuel Jourdan's icon
      Emmanuel Jourdan
      Aug 28 2013 | 12:10 pm
      You might have some chances with dict.deserialize.
      Share
    • mzed's icon
      mzed's icon
      mzed
      Aug 28 2013 | 3:12 pm
    • mzed's icon
      mzed's icon
      mzed
      Aug 28 2013 | 3:45 pm
      Max Patcher
      In Max, select New From Clipboard.
      Show Text
      This is almost ok:
    • gwsounddsg's icon
      gwsounddsg's icon
      gwsounddsg
      Aug 28 2013 | 8:41 pm
      dict.deserialize followed by dict.itter did the job!
      Thanks GW
    • bpcook's icon
      bpcook's icon
      bpcook
      Apr 16 2014 | 4:54 am
      How so? I have a similar JSON string and can't figure out how to parse it with dict.deserialize and dict.itter. Maybe I am just too tired to figure it out. Please post a patch if you don't mind.
    • Jan's icon
      Jan's icon
      Jan
      Apr 16 2014 | 10:44 am
      another option would be to do the parsing in JavaScript directly using JSON.parse(your-json-string)
    • Philip's icon
      Philip's icon
      Philip
      Mar 19 2015 | 9:38 am
      Hi folks, hope it's not frowned upon here to revive a thread... I seem to be having the same issue as bpcook and I was wondering if/how you solved it?
      Cheers pc
    • nicolasnuzillard's icon
      nicolasnuzillard's icon
      nicolasnuzillard
      Jun 29 2017 | 11:32 am
      just in case
      function f (){
      	var str =  '{ "name":"John", "age":31, "city":"New York" }';
      	var res = JSON.parse(str);
       	post(  res.name + '\n' );
      	post(  res.age + '\n' );
      	post(  res.city + '\n' );
      }