How to get it prettyfied?

Hello everyone,

possibly a silly question, but I don’t know how to switch on the prettyfied version of JSON export.

What I already found is this article How do TWs JSON Formats Look Like

which explains the JSON format and also the prettyfied form…

and this one Accessing Tiddlyhost data as JSON · simonbaird/tiddlyhost Wiki · GitHub

which shows the usage of url-parameters to get even the pretty formatted JSON.

What I need is prettyfied JSON Format from a filter expression via the AdvancedSearch tool. There must be somewhere a hidden option to switch between the normal condensed JSON output and the prettyfied readable form.

I would be grateful for any hint…

kindly regards
Michael

I did use VSCode to prettify the JSON structures for human readability. ATM there is no setting in TW to export to pretty printed JSON files.

But IMO it would be worth an other thought. … There is an open issue at GH that talks about different formatting of JSON in the “preview section” of the editor

Usually templates are used to export tiddlers and internal function parameters need to be set if the creation is done by filter operators. We’ll have to have a closer look

Okay, thanks for your fast reply!

I wonder how the url triggered export on tiddlyhost is done.
I used this form (see second link) and simply thought it is an inbuilt function of the TW core…

Unfortunately via url you can only export all tiddlers or one named tiddler, but not a filtered set of tiddlers.

Meanwhile I have found pretty good online tools to reformat compact JSON data.
for example this one https://jsoneditoronline.org/

So the formatting isn’t anymore a critical issue for me :upside_down_face:

Thank you for clarifying about these JSON internals…

Hi @Michael_Schroder try creating a new tiddler with the following fields:

title: $:/core/templates/exporters/JsonFilePrettified
tags: $:/tags/Exporter
description: Prettified JSON
extension: .json
text: <$macrocall $name="jsontiddlers" filter=<<exportFilter>> $output="text/raw" spaces="2"/>

You should then see a new “Prettified JSON” option in the export format dropdown.

1 Like

Many thanks @jeremyruston
it works well out of the box!