This extension brings the JSONata query engine to Visual Studio Code.
Features
This extension enables JSONata language support to Visual Studio Code. The extension is activated for files with the *.jsonata extension.
We also support JSONata Notebooks. They are automatically activated for files with the *.jsonata-book extension.
Within notebooks several additional functions are available:
$parseString($content[, $type]) takes up to two arguments. It parses $content into an JSON object. This happens based on the variable $type with a JSON or an XML parser. JSON is the default parser.
$loadFile($file[, $type]) takes up to two arguments. $file represents the filename to be loaded. With the optional argument $type one can specify how this file should be loaded. At the moment only json and xml can be chosen whereas json is the standard if $type is missing.
$loadUrl($url[, $type]) works just like $loadFile() but with URLs instead of files.
$readFile($file) reads a file and returns the result as a string.
$writeFile($file, $content) writes the data of $content into the file $file. The content can be an object and is stringified as a JSON string. The indentation is set to 2.
$readUrl($url) reads a url and returns the result as a string.
$eval($content) evaluates a string using the JSONata compiler.
$import($file) imports a file and evaluates it. This is useful for defining often used functions in a separate file and then include it in a notebook. If several functions shall be imported from a single file, then export them as a object. This could look like this: