On Mon, 29 Aug 2011, Hans-Christoph Steiner wrote:
On Aug 26, 2011, at 7:00 PM, Thomas Mayer wrote:
I could output this as list, which would make spaces in values not break the pattern of "key value key value key value" (really?). But is this really a way to represent data in the correct Pd way, i.e. does this data format fit the principle of least surprise?
How about a message per key/value pair? Then you just need to ensure that the key does not have spaces in it, then the value can be a symbol, float, list, etc.
What's the «etc» standing for ?
What else could it be, other than symbol, float, list ?
If CouchPdb is outputting an object, and that object contains an object, and that object contains an object, you have two different ways of handling « getting the keys and values of an object » for the toplevel object and the first-level subobjects, but the second-level subobjects are toast. Sending separate key-pairs only push back the problem by one level of nesting.
BTW, with a real-world example : if you parse JSON output from GoogleMaps search results, the coordinates of an item are two values for keys "lat" and "lng" in an object assigned to the key "location" in an object assigned to the key "geometry" in an object that is in an array that is assigned to the key "results" in the toplevel object. (If instead you want to access a bounding-box on the map, it's one level deeper than that).
(That's my only contact with JSON.)
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC