<div>(from Sébastien:) </div><blockquote class="gmail_quote" style>We were thinking that a simple JSON file would save a lot of trouble :<br>- it has a nested structure, which allows for much clearer, even human-readable format. ex :<br>
[<br>   {&quot;class&quot;: &quot;obj&quot;, &quot;id&quot;: 0, &quot;type&quot;: &quot;osc~&quot;, &quot;args&quot;: [440]},<br>   {&quot;class&quot;: &quot;obj&quot;, &quot;id&quot;: 1, &quot;type&quot;: &quot;dac~&quot;},<br>
   {&quot;class&quot;: &quot;connect&quot;, &quot;from&quot;: [0, 0], &quot;to&quot;: [1, 0]},<br>   {&quot;class&quot;: &quot;connect&quot;, &quot;from&quot;: [0, 0], &quot;to&quot;: [1, 1]}<br>]<br><br>- it allows putting custom attributes (for a GUI for example) :<br>
[<br>   {&quot;class&quot;: &quot;obj&quot;, &quot;id&quot;: 0, &quot;type&quot;: &quot;osc~&quot;, &quot;args&quot;: [440],<br>       &quot;myGui&quot;: {&quot;x&quot;: 123, &quot;y&quot;: 78}<br>   }<br>]<br><br></blockquote>
<div style><br></div><div style>Strict json has a dictionary as it&#39;s outermost object.  Most parsers will accept an array as you have done, but not all (Obj-C&#39;s TouchJSON as an example).  An alternative way to organize the patch and adhere to strict json would be to have id&#39;s on the outside, such as:</div>
<div style><br></div><div style><div>{</div><div><span style="white-space:pre-wrap">        </span>&quot;canvas&quot; :</div><div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>&quot;id&quot; : 1,</div>
<div><span style="white-space:pre-wrap">                </span>&quot;name&quot; : &quot;example&quot;</div><div><span style="white-space:pre-wrap">                </span>&quot;x&quot; : 95,</div><div><span style="white-space:pre-wrap">                </span>&quot;y&quot; : 190,</div>
<div><span style="white-space:pre-wrap">                </span>&quot;width&quot; : 809,</div><div><span style="white-space:pre-wrap">                </span>&quot;height&quot; : 538</div><div><span style="white-space:pre-wrap">                </span>&quot;elements&quot; :</div>
<div><span style="white-space:pre-wrap">                </span>{</div><div><span style="white-space:pre-wrap">                        </span>&quot;obj&quot; : {&quot;id&quot; : 0, &quot;type&quot;: &quot;osc~&quot;, &quot;args&quot;: [440]},</div><div><span style="white-space:pre-wrap">                        </span>&quot;obj&quot; : {&quot;id&quot; : 1, &quot;type&quot;: &quot;dac~&quot;},</div>
<div><span style="white-space:pre-wrap">                        </span>&quot;connect&quot; : {&quot;from&quot;: [0, 0], &quot;to&quot;: [1, 0]},</div><div><span style="white-space:pre-wrap">                        </span>&quot;connect&quot; : {&quot;from&quot;: [0, 0], &quot;to&quot;: [1, 1]}</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span>&quot;canvas&quot; : { ... }</div><div><span style="white-space:pre-wrap">                </span>&quot;array&quot; : { ... }</div>
<div><span style="white-space:pre-wrap">        </span>}</div><div>}</div></div><div style><br></div><div style>About the optional GUI, my opinion is that pd is firstly a graphical data flow language existing of canvases and objects with specific location.  To make the dimensions optional means interoperability with pd will be optional, probably not so good.  If you need extra info, I think that&#39;s ok, but at a minimum the information in existing pd patches should be represented.</div>
<div style><br></div><div style>You could also pull the GUI locations into a separate object:</div><div style><br></div><div style><div>{</div><div><span style="white-space:pre-wrap">        </span>&quot;canvas&quot; :</div><div>
<span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>&quot;id&quot; : 0,</div><div><span style="white-space:pre-wrap">                </span>&quot;name&quot; : &quot;example&quot;</div><div>
<span style="white-space:pre-wrap">                </span>&quot;elements&quot; :</div><div><span style="white-space:pre-wrap">                </span>{</div><div><span style="white-space:pre-wrap">                        </span>&quot;obj&quot; : {&quot;id&quot; : 0, &quot;type&quot;: &quot;osc~&quot;, &quot;args&quot;: [440]},</div>
<div><span style="white-space:pre-wrap">                        </span>&quot;obj&quot; : {&quot;id&quot; : 1, &quot;type&quot;: &quot;dac~&quot;},</div><div><span style="white-space:pre-wrap">                        </span>&quot;connect&quot; : {&quot;from&quot;: [0, 0], &quot;to&quot;: [1, 0]},</div>
<div><span style="white-space:pre-wrap">                        </span>&quot;connect&quot; : {&quot;from&quot;: [0, 0], &quot;to&quot;: [1, 1]}</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span>&quot;layout&quot; :</div>
<div><span style="white-space:pre-wrap">                </span>{</div><div><span style="white-space:pre-wrap">                        </span>&quot;0&quot; : { &quot;pos&quot;: [123, 78] },</div><div><span style="white-space:pre-wrap">                        </span>&quot;1&quot; : { &quot;pos&quot;: [123, 100] }</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>&quot;layout&quot; :</div><div><span style="white-space:pre-wrap">        </span>{</div>
<div><span style="white-space:pre-wrap">                </span>&quot;0&quot; : { &quot;pos&quot;: [95, 190], &quot;size&quot; : [809, 538] }</div><div><span style="white-space:pre-wrap">        </span>}</div><div>}</div></div><div style><br></div>
<div style>Don&#39;t know if it&#39;s better or worse, just throwing it out there.  One side effect is that the id&#39;s here are both in string and int format.</div><div style><br></div><div style> </div><blockquote class="gmail_quote" style>
<div><br>----------------------------------------------------------------------<br><br></div><div>Comment By: Andras Muranyi (muranyia)<br></div>Date: 2012-06-01 14:00<br><br>Message:<br>@reakin: when mentioning two files for one patch i was referring to the<br>
(nice and convenient) idea of separating logic from presentation by<br>breaking out GUI info into a CSS-like file - which means having two files<br>per patch (not so convenient and nice). <div><br></div></blockquote><div style>
<br></div><div style>Ah, understood.  I also think this would be a bit overcomplicated.  If it&#39;s separated, I think the GUI info could just be under a different object in the json of one file.</div><div style> </div><div style>
Cheers,</div><div style>Rich</div><br><div class="gmail_quote">On Sat, Jun 2, 2012 at 2:01 PM, yvan volochine <span dir="ltr">&lt;<a href="mailto:yvan.pd@gmail.com" target="_blank">yvan.pd@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 06/02/2012 07:50 PM, s p wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, ... moving the discussion here from sourceforge&#39;s tracker :<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@Sébastien will you write a .json -&gt;  .pd converter too?<br>
</blockquote>
<br>
Rich, notice the double arrow &quot;.json&lt;-&gt;  .pd&quot; ;)<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
the proposal is for a new, easier to read / parse, format for existing<br>
</blockquote>
patches. This facilities writing/reading patches in other languages (such<br>
as javascript, C / C++ / Obj-C / Java, etc.), since you wouldn&#39;t need to<br>
write the text file in a cryptic form.<br>
</blockquote>
<br></div>
I am certainly not a pd-veteran but I think this is a *very good* idea.<span class="HOEnZb"><font color="#888888"><br>
<br>
y<br>
<br>
-- <br>
<a href="http://yvanvolochine.com" target="_blank">http://yvanvolochine.com</a><br>
<a href="http://vimeo.com/yv" target="_blank">http://vimeo.com/yv</a><br>
<a href="http://soundcloud.com/yvanvolochine" target="_blank">http://soundcloud.com/<u></u>yvanvolochine</a><br>
<br>
______________________________<u></u>_________________<br>
Pd-dev mailing list<br>
<a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a><br>
<a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-dev</a><br>
</font></span></blockquote></div><br>