Automatically generating tiddlers from json (or other static file)

Hello, I am new to using TiddlyWiki but found that it suited my needs quite well - a static wiki that can be easily hosted and edited without too much fuss. I want to use it as a source of information for my friends to read about.

However I did have a question about the ability to generate tiddlers automatically from an external file. After some searching, I did not find a conclusively popular (or indeed widespread) method of doing so. Is there a way to cleverly use tm-new-tiddler to accomplish this goal? Or is it perhaps possible to unpack a tiddlywiki file, write a [language] script that does what I want, then pack it back up?

Any help is much appreciated.

Wait, I have found a post in the Tips and Tricks forum that seems to do what I need. I just used the wrong keywords, it seems. This forum is truly a repository of wisdom.

2 Likes

Welcome @CitrusFruit ,

Have you just tried importing the external file then try to turn it into a tiddler?

Perhaps rather than thinking about the method what is the ultimate result you are trying to achieve?

  • Import content
  • Display content
  • Make tiddler to share?
  • Convert a files content into another form or tiddlers
    • Can you share a sample of the file?

It would be nice, if you would let us know, what you found. So we don’t have to link it twice :wink:

Of course. So, here’s the way I solved my problem.

I read this topic:

And realized that you could import jsons natively to TW simply by dragging them in, and if the formatting was correct, then individual tiddlers would be automatically generated per object.

After creating and exporting an experimental tiddler, I found out that the exported tiddler had a number of typical properties (e.g. “created”, “modified”, “type”, “custom-property-1”, etc.)… and when I fiddled with the json and removed them one by one, I noticed that the only crucial property for a json object to be recognized as a tiddler is the “title” property.

So, I ended up solving the problem by writing a python script to reformat the json files I already had from another source. :slightly_smiling_face: Easy as py.

1 Like

In the past I would have suggested using “JSON Mangler”, but the demo page is missing and it’s unclear if it works with 5.2.2 .

Mostly the advantage is that you wouldn’t need to have python available, so the solution would be self-contained and portable.