Skip to content

Exporting Data from Twine to JSON

Graham Earley edited this page Feb 7, 2017 · 8 revisions

JSON is the format that Prairie uses for reading your Twine stories. To get your Twine story into Prairie, you'll have to export the story to JSON format.

In this tutorial, we'll show you

  • how to install the JSON format in the Twine web interface
  • how to use that format to export your data from the Twine web interface

Installing the JSON format in Twine

In order to export your data to JSON, you need to add a JSON formatter to Twine. We'll use lazerwalker's Twison formatter.

To add this format, go to your Twine web interface and click Formats in the right-hand sidebar. In the screen that pops up, select the Add a New Format tab and paste in http://lazerwalker.com/twison/format.js. Then, back in the Story Formats tab, click the Star button if you want to export to this format by default.

Exporting a Twine story to JSON

Open a Twine story you'd like to use in Prairie. Now, before moving forward, double check that this story is set to export in the JSON format! To do so, click the upward-pointing arrow to the right of the story name in the bottom bar. In the menu that pops up, select Change Story Format. Then ensure that TwineJson is selected as your story format.

Now, with this format selected for your story, simply press Play. This will generate the JSON for your story and display it in a new tab. In that tab, select all the text by pressing Control A (PC) or Command A (Mac) on your keyboard. Then copy the text, as shown below. You will later paste this text into Unity through Prairie.

With that JSON copied into your clipboard, move on to the next tutorial to see how to add it to Prairie!