1

In a Tiddlywiki macro, what is the standard way to load JSON data from a JSON tiddler?

Currently, I've done this:

var my_dict = JSON.parse(this.wiki.getTiddlerText("my_json"))

Loving Tiddlywiki. Thank you!

fzzylogic
  • 2,183
  • 1
  • 19
  • 25

1 Answers1

1

Unless a better answer comes along:

Yes, this is the way.

But note that in some cases you'll have to use the $tw object (instead of 'this'), for example in a custom parser (such as tiddler of type 'application/javascript' and module-type: 'wikirule'):

var my_dict = JSON.parse($tw.wiki.getTiddlerText("my_json_tiddler"))
fzzylogic
  • 2,183
  • 1
  • 19
  • 25