[TW5] Json Mangler v2.1.0!

78 views
Skip to first unread message

Joshua Fontany

unread,
Mar 16, 2020, 10:35:54 PM3/16/20
to TiddlyWiki
Hi everyone,

I've worked a few bugs out and introduced a more flexible `indexes[]` filter. Hopefully this will make jsonmangler robust enought for some really cool projects.

Looking forward to what people do with these new capabilities. I have included a standard documentation tiddler for the new functions:

https://joshuafontany.github.io/TW5-JsonMangler/#indexes%20Operator

purposeselect all data properties of the input titles (see output)
inputselection of titles
suffixthe indexes operator uses a rich suffix, see below for details
parameter(optional) an index-path to a property in the data tiddler
outputthe property names or indices found at the tiddler or path location provided (only immediate properties are returned if the ":root" suffix is used)

Each input title is processed in turn, and is ignored if it does not denote a data tiddler. The list of property names is retrieved from the data tiddler (in no particular order) and then dominantly appended to the operator's output.

Where a tiddler's content is JSON, the indexes operator uses an extended syntax:

[indexes:root[<path>]]
  • root: a flag to only retrieve the immediate ("root") indexes from the tiddler or path location
  • path: a slash-delimited index path (see the Read Me)

Examples


There are Examples in the new demo wiki as well.

Download the source or *.zip over on GitHub:

https://github.com/joshuafontany/TW5-JsonMangler

Best,
Joshua Fontany

Joshua Fontany

unread,
Mar 17, 2020, 7:05:54 PM3/17/20
to TiddlyWiki
I occurred to me after sleeping on it that making the `:root` suffix the default, and having another one like `;all` to toggle returning all sub-paths would be much more "backwards compatible" to exiting tiddlywiki markup/macros/etc.

I will me making that change as the 2.1.1 release.

Best,
Joshua F

Joshua Fontany

unread,
Mar 17, 2020, 8:50:03 PM3/17/20
to TiddlyWiki
v2.1.1 posted!

indexes Operator

17th March 2020 at 4:49pm
Filter Operators
purposeselect all data properties of the input titles (see output)
inputselection of titles
suffixthe indexes operator uses a rich suffix, see below for details
parameter(optional) an index-path to a property in the data tiddler
outputthe immediate (root) property names or indices found at the tiddler or path location provided (all property paths are returned if the ":all" suffix is used)

Each input title is processed in turn, and is ignored if it does not denote a data tiddler. The list of property names is retrieved from the data tiddler (in no particular order) and then dominantly appended to the operator's output.

Where a tiddler's content is JSON, the indexes operator uses an extended syntax:

[indexes:all[<path>]]
  • all: a flag to retrieve the full path to all properties in the JSON tiddler. By default, only the immediate ("root") indexes from the tiddler or path location are returned.
  • path: an index or slash-delimited index path (see the Read Me).

Examples


https://joshuafontany.github.io/TW5-JsonMangler/


Best,
Joshua Fontany


On Monday, March 16, 2020 at 7:35:54 PM UTC-7, Joshua Fontany wrote:
Reply all
Reply to author
Forward
0 new messages