DataTiddlerPlugin and ForEachTiddlerPlugin -- getting to nested objects

36 views
Skip to first unread message

adc...@gmail.com

unread,
Oct 18, 2012, 9:02:57 PM10/18/12
to tiddl...@googlegroups.com
Hello,

I'm trying to use a TiddlyWiki to analyze sets of JSON files that I have stored as tiddlers.  I realized recently that the combination of DataTiddlerPlugin and ForEachTiddlerPlugin could be very powerful for what I'm doing.  I've got a problem when dealing with nested objects though...  For example:

<<showData>>
<data>{
   "foo" : "0",
   "bar" : [
      {
         "baz" : [
            "42",
            "128"
         ]
      }
   ]
}</data>

This will show correctly as a table, but when I try to use a forEachTiddler call somewhere else, I don't know how, or if, I can dig into the "bar" object.  The following code will show "[object Object]" in the result area for "bar".  I'd like to be able to do something like tiddler.data("bar.baz") to list 42 and 128.  Is there a way to express this properly, or can the data call only show top level values?

<<forEachTiddler
    where
        tiddler.data("foo") == "0"'
    write
        '"|[["+tiddler.title+"]]|"+tiddler.data("foo")+"| "+tiddler.data("bar")+"|\n"'
>>

Thanks!

Michael
Reply all
Reply to author
Forward
0 new messages