I actually use JSON in JQuery on my own website to handle AJAX callbacks, it’s not a foreign language to me. I was simply asking if there is a way in standard rules files.
Right now I am finding rules files far more convenient, however I am open to change.
There really isn’t “standard” rules. There are several options (see the Automation category of openHAB add-ons), all equally standard in their own right. Rules DSL is but one option, and frankly one of the least optimal choices these days. If you are not great at programming, Blockly is simpler to understand and more capable.
Well, no you can’t have them in .rules files. But you can have them in .js files. If you used jRuby you can use .rb files. All the details are in the readme docs for the respective add-ons: e.g. JS Scripting. With the exception of Blockly, all rules languages support file based rules.
That appears to be a Blockly Block Library. It can only be used in Blockly which, being graphical, can only be used through the UI. But Blockly converts to JS Scripting behind the scenes and all that library does is make the JSON class available as coding blocks that can be used in Blockly.
In other words, if you were to use JS Scripting directly, there’s nothing to import. JSON is part of the base language.
But if you did have a third party node module you wanted to use in JS Scripting (e.g. openhab_rules_tools), that can be installed via npm and imported into your rules (UI or file based) using the usual require command.
All the rules languages except for Java Rule (files only) and Blockly (UI only) can be used either from the UI or from files. But the details for using files depends on the individual language.