[Dev] [TW5] Json Mangler v2.1.0!

61 views
Skip to first unread message

Joshua Fontany

unread,
Mar 16, 2020, 10:35:47 PM3/16/20
to TiddlyWikiDev
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:04:59 PM3/17/20
to TiddlyWikiDev
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



Best, Josh F

Joshua Fontany

unread,
Mar 17, 2020, 8:50:28 PM3/17/20
to TiddlyWikiDev
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:47 PM UTC-7, Joshua Fontany wrote:

TonyM

unread,
Mar 18, 2020, 6:38:45 PM3/18/20
to TiddlyWikiDev
Josua,

As you know I follow your work on this, and I have let you know I am impressed. As an IT Professional I expect to use you wonderful resource to "pull a rabbit out of a hat" when sophisticated data transfer or import is required. I am keen to spend time with it to be more familiar with it and perhaps craft some high level guidance material because being so comprehensive "the possibilities" it would help. 

With your various operators I wonder if a subset of these should be available to more users than those needing the full suite, in some cases even included in the standard release?

I have being playing games with the import process, moving imports into plugins or json files and republishing content. I have discovered so many opportunities that it will take time for me to develop a "best practice" however I see methods to increase the utility of json and csv files within tiddlywiki.

I want to propose a collaboration if you are interested and we are isolated in coming weeks, basically to develop and promote the use of json and other data tiddlers more and position your tools effectively. A set of methods and work flows based on your work and my own.

Here are some objectives I have in mind;
  • Easy packaging for drag and drop of any combination of tiddlers and solutions
  • Easy table JSON to csv and tables exchange
  • Developing json and/or plugins with test data as reference data for sharing with the community in troubleshooting
    • Where a rich set of test data is available so people can test against a reference set of data rather than share their own data
  • Using such tools for extracting data from other systems or services with examples
What do you think?

Regards
Tony
Reply all
Reply to author
Forward
0 new messages