That is also the direction I was leaning (text-references and the 
getindex[] filter).

Mahalo (thanks) Evan! Definitely gives me a good place to start. Now to 
think about path syntax....

Best,
Joshua Fontany

On Wednesday, December 27, 2017 at 7:17:55 PM UTC-8, Evan Balster wrote:
>
> I have to assume that it's just a limitation in how the JSON structure is 
> translated to and from text references.  JSON doesn't actually have an 
> "official" addressing scheme for sub-objects, only add-on standards like 
> JSON pointer.  TiddlyWiki allows most characters (including dots) in field 
> names.
>
> Relevant functions in the TiddlyWiki core code:  getTextReference --> 
> extractTiddlerDataItem --> getTiddlerDataCached --> getTiddlerData
>
> Looks like internally, the whole JSON structure is parsed, but 
> extractTiddlerDataItem has no rule to look for a delimiter (like ".") and 
> access sub-objects.  This bit of code in that function would need to be 
> expanded into something more complicated:
>
>       if(data && $tw.utils.hop(data,index)) {
>               text = data[index];
>       }
>
>
> ...So at a glance this looks like it would be a pretty easy "mod" to 
> implement, if you're willing to mess with some core code.
>
> On Wednesday, 27 December 2017 13:15:32 UTC-6, Joshua Fontany wrote:
>>
>> Hi all you tiddlywiki dev folks,
>>
>> I am making progress with my RenderTable widget, but have run into a 
>> situation where I need to add or remove items from arrays listed in JSON 
>> tiddlers. This is so I can add/remove "table rows" when the table is being 
>> fed by "application/json" tiddlers. I have a solution sketched out for 
>> using javascript's array.splice() method, but had a question before I start.
>>
>> *Why can we currently access only the "root level" elements of a JSON 
>> tiddler?*
>>
>> Is this a performance or other technical limitation or has a solution for 
>> this just not been created yet?
>>
>> Currently, I "flatten" my JSON tiddlers with another plugin I made in 
>> order to simulate storing data as nested objects & arrays. I can then 
>> access the data I want with a "path" key/index. If this "flattening" is 
>> unnecessary, I'd love to be able to work on allowing regular "nested" JSONs 
>> to be used within tiddlywiki. Otherwise, I'll have to work around the 
>> limitation.
>>
>> Thank you all for any insight you can provide while I go and read through 
>> the core tiddlers that reference JSON stuff. :D
>>
>> Best,
>> Joshua Fontany
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/c36840f3-15c2-44c5-a6de-c3b947b879b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to