Prior Art? Create tiddler in JSON file?

61 views
Skip to first unread message

TW Tones

unread,
Aug 18, 2020, 10:42:56 PM8/18/20
to TiddlyWiki
Folks,

Has anyone developed a method to create multiple tiddlers directly into a JSON tiddler?

Background

I just built a macro to create color swatch tiddlers, more than 800.
  • I will share it soon, once I create some tools for color search and copy tools
  • I did it Using a button containing a list and the 

    ActionCreateTiddlerWidget


What?

However I realised since the action create widget is basically handed a set of field=values it should be easy enough to create such tiddlers in a JSON file only as JSON tiddlers. 
  • It would need an append process
I will eventually build this myself if there is no response however please share any previous examples "Prior Art"  of doing this. It seems to me as deserving of a facility in the core so perhaps others have done it better than I can hope to.

Why?
  • When creating large numbers of reference or data tiddlers they could be created directly into a json file saving space ?, but permitting access as shadow tiddlers. While keeping the number of real tiddlers small. 
  • It could allow an intermediate step from what you choose to make into a real tiddler. Then delete the JSON when finished.
  • It would allow virtual tiddlers to be created from tiddlywiki content that exist only in the JSON format. 
  • JSON's are readily converted to drag-able packages, import tiddlers and plugins.
  • JSONS can be interrogated as shadow tiddlers or as data-tiddlers.
Thanks in Advance
Tones

Werner

unread,
Aug 19, 2020, 6:16:21 AM8/19/20
to TiddlyWiki
Tony, as you may recall, I've experimented a bit with Joshua Fontany's great JSONMangler plugin and (nested) JSON data tiddlers. I think, the plugin provides the tool you need.

But, after a bit of a learning curve, I found I was able to get it to work and to access and retrieve data. I am not fully happy, though.

The main issue I have is that JSON only offers minimum features. It stores data. Period. When you want to retrieve data, they come out in the way you have stored them, unless you want to mimic features in TW normally offered by a *DBMS. E.g. for retrieval in a given sort order, you will need to either use one of the sort functions on the whole data set or create an ISAM feature in TW. As I wrote before, this is a rabbit hole I would be reluctant to jump into. There has been work put into this topic by minds more proficient than me, So I'd rather resort to the work done by them. Also, I don't know, how JSON performs with large datasets, but I would assume at 800 records there won't be too much performance issues.

So, for the time being, I will stick to my TW-based solution, but in the long run I feel tempted to try out PouchDB/CouchDB which seems like the natural complement for this kind of problem.

Best, Werner

TW Tones

unread,
Aug 19, 2020, 7:15:50 AM8/19/20
to TiddlyWiki
Werner,

Thanks for your thoughts. This particular example of 800 tiddlers is not necessary the standard case. For example just moving a couple of tiddlers into a JSON would be common.

Perhaps I am miss-guided but I was hoping for a simple to use answer, one like a version of the actioncreatetiddler that generates the tiddler inside a json tiddler, appending if any already there. In fact in this case I only want JSON to store tiddlers, which it already does, look inside any plugin tiddler.

Although I too, treasure Joshua Fontany's great JSON Mangler as opening tiddlywiki to all JSON files.

Another use case I have is generating a project or wiki tiddler from various content in the project or wiki and storing it in a JSON (one or more tiddlers eg multiple projects) the result can be dropped on a directory wiki that can list all wikis and projects and their location file/url and tiddlername.

I agree the database versions of tiddlywiki stand to make a lot of difference, but that is not what I am looking for here, thanks

Tones
Reply all
Reply to author
Forward
0 new messages