### Debugging Notepad++ Plugins with Visual Studio Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/PluginPackInfo.md This section explains how to set up Visual Studio for debugging Notepad++ plugins. It covers starting debugging directly or attaching to an already running Notepad++ process. It also mentions configuring Visual Studio to automatically launch Notepad++ when debugging starts. ```C# In Visual Studio, choose Platform to debug (x86 or x64) Make sure Notepad++ is not running Start Debugging (F5 by default) Or you can attach to a running process: start notepad++ in Visual Studio: debug -> attach to process... -> notepad++.exe you can make this process easier by setting the "start action" in the project -> properties -> debug to start notepad++.exe - then you can simply build and hit `F5`. ``` -------------------------------- ### RemesPath: Variable Redefinition Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Shows an example of redefining a variable in RemesPath, demonstrating that reassignment is handled correctly and does not lead to infinite loops. ```RemesPath var bar = @.bar; var baz = @.baz; var barbaz = bar + baz; var baz = @{bar, baz, barbaz}; baz ``` -------------------------------- ### Install JsonToolsNppPlugin (64-bit) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/README.md Download the 64-bit version of the JsonToolsNppPlugin and unzip the DLL to the Notepad++ plugins directory. ```Shell unzip Release_x64.zip -d "C:\Program Files\Notepad++\plugins\JsonTools\" ``` -------------------------------- ### Install JsonToolsNppPlugin (32-bit) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/README.md Download the 32-bit version of the JsonToolsNppPlugin and unzip the DLL to the Notepad++ plugins directory. ```Shell unzip Release_x86.zip -d "C:\Program Files (x86)\Notepad++\plugins\JsonTools\" ``` -------------------------------- ### RemesPath Truthiness Examples Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates the concept of 'truthiness' in RemesPath, where non-boolean values are evaluated in a boolean context. Includes examples for numbers, strings, arrays, and objects. ```RemesPath true ``` ```RemesPath false ``` ```RemesPath 0 ``` ```RemesPath 0.0 ``` ```RemesPath 10 ``` ```RemesPath "" ``` ```RemesPath "hello" ``` ```RemesPath [] ``` ```RemesPath {} ``` ```RemesPath [1, 2] ``` ```RemesPath {"a": 1} ``` ```RemesPath null ``` -------------------------------- ### JSON Formatting: Google Style Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Presents JSON data formatted according to the Google style guide, including brace placement and indentation. ```json { "a": [ 1, [ 2 ] ] } ``` -------------------------------- ### RemesPath Array Projection Example (Sum and Average) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates creating an array projection from an array of arrays, calculating the sum and average of each inner array. ```RemesPath @[:]{sum(@), avg(@)} ``` -------------------------------- ### RemesPath Object Projection Example (Sum and Average) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Shows how to create an object projection from an array of arrays, calculating the sum and average of each inner array and assigning them to keys. ```RemesPath @[:]{row_sum: sum(@), row_avg: avg(@)} ``` -------------------------------- ### RemesPath f-string Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates the usage of f-strings in RemesPath for string interpolation, including how to embed expressions and handle literal curly braces. ```RemesPath f`first a = {@[0][a]}. Is first b less than second b? {@[0].b < @[1].b}! Show me third c: {@[2].c}` ``` ```RemesPath f`sum of b's, wrapped in curlybraces = {{ {sum(@[:].b)} }}` ``` -------------------------------- ### RemesPath: Chained Indexing Examples Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates the behavior of chained indexers in RemesPath, showing how subsequent selections operate on the results of previous ones, including array slicing and object key selection. ```RemesPath @[:2][1] ``` ```RemesPath @[:].b[0] ``` ```RemesPath @[0][b, a] ``` -------------------------------- ### RemesPath zfill Function Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md The zfill function pads a string or number with leading zeros to a specified length. It was added in version 6.1. ```RemesPath zfill(10, 5) ``` ```RemesPath zfill(ab, 4) ``` -------------------------------- ### Building 32-bit and 64-bit Notepad++ Plugins Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/PluginPackInfo.md This guide explains the necessity of creating both 32-bit (x86) and 64-bit (x64) versions of Notepad++ plugins due to the dual nature of the Notepad++ application. It shows how to switch the target platform in Visual Studio and specifies the output directories for the compiled DLLs. ```C# Using this template you can switch between the two using the Visual Studio "Target Platform" drop-down. When publishing your plugin you should build in Release mode for both x86 and x64 and publish both resulting dll's (e.g. `bin/Release/myPlugin.dll` and `/bin/Release-x64/MyPlugin.dll`) ``` -------------------------------- ### Get JSON from Files and APIs using JsonTools Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Explains how to use the JsonTools plugin to retrieve JSON data from local directories or by sending REST API requests. The tool can be accessed via the 'Plugins->JsonTools->Get JSON from files and APIs' menu command or a keyboard shortcut. It allows users to input URLs for API requests, with support for entering URLs as a JSON array. The plugin displays successful requests and provides a way to view errors. ```JSON ["http://example.com/api/data1", "http://example.com/api/data2"] ``` -------------------------------- ### RemesPath: Vectorized Operations on Objects Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates vectorized operations applied to values within an object. Examples include exponentiation, bitwise AND, and comparisons against a specific object property. ```RemesPath @ ** @ @ & 1 @ > @.a ``` -------------------------------- ### RemesPath: Vectorized Arithmetic Operations on Arrays Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Provides examples of vectorized arithmetic operations applied to each element of an array. This includes multiplication, string conversion, division, and comparison. ```RemesPath 2 * @ str(@) @ + @ / 2 @ > @[1] ``` -------------------------------- ### RemesPath Array Projection Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates creating an array projection from a JSON array of arrays, calculating the length, first element's length, and last element's length for each subarray. ```RemesPath @{len(@), len(@[0]), len(@[-1])} ``` -------------------------------- ### Example: Boolean Indexing with Array Filtering Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates filtering an array of objects based on a condition within each object, then selecting a specific field from the filtered results. ```RemesPath @[@.a < 2].b ``` -------------------------------- ### RemesPath Grammar - Slicing Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath language spec.txt Defines the syntax for slicing arrays or strings, allowing for start, end, and step parameters. ```BNF SLICER := INTEGER? COLON INTEGER? (COLON INTEGER?)? SLICER_LIST := OPEN_SQUAREBRACE SLICER_INTS CLOSE_SQUAREBRACE SLICER_INTS := SLICER_INT SLICER_INTS | SLICER_INT SLICER_INT := INTEGER | SLICER ``` -------------------------------- ### RemesPath Assignment Expression Examples Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates the use of assignment expressions in RemesPath to mutate data, including modifying array elements and string slices. ```RemesPath @.foo[@ < 0] = @ + 1 ``` ```RemesPath @.bar = s_slice(@, :2) ``` ```RemesPath @.g`b` = s_len(@) ``` -------------------------------- ### JSON to CSV Key Separator Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Illustrates the effect of the 'keysep' option on column naming when converting JSON to CSV. It shows how different separators ('.' and '_') create different column names for nested data. ```json {"b": [{"a": [1, 2, 3]}]} ``` -------------------------------- ### Example: Grouping Parentheses with Array Filtering Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates the use of grouping parentheses to correctly filter elements within nested arrays and then select the first element of each resulting sub-array. ```RemesPath @[:].a[@ > @[0]] ``` -------------------------------- ### Managing Dependencies with ILMerge via MSBuild Task Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/PluginPackInfo.md This snippet details the preferred method for managing external dependencies in Notepad++ plugins: using NuGet to install the MSBuild.ILMerge.Task. This task integrates with the Visual Studio build process to merge managed libraries into the plugin's DLL, simplifying deployment. It also notes the requirement to target at least .NET Framework 4.0. ```XML ... ... net40 ... ``` -------------------------------- ### JsonTools String Sorting Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/README.md Demonstrates the difference between JsonTools' case-sensitive and case-insensitive string sorting compared to Notepad++'s default sorting based on Unicode code points. It uses a sample array of strings including numbers, letters, and special characters. ```JSON [ "1", "-2", "3", "o", "P", "ö", "p" ] ``` ```JSON __JsonTools case-*sensitive* order:__ [ "1", "-2", "3", "o", "ö", "p", "P" ] ``` ```JSON __JsonTools case-*insensitive* order:__ [ "1", "-2", "3", "o", "ö", "P", "p" ] (the order of the `P` and the `p` is unstable) ``` ```JSON __Notepad++ case-*sensitive* order:__ [ "-2", "1", "3", "P", "o", "p", "ö" ] ``` ```JSON __Notepad++ case-*insensitive* order:__ [ "-2", "1", "3", "o", "P", "p", "ö" ] (the order of the `P` and the `p` is unstable) ``` -------------------------------- ### JSON to CSV Conversion Example (Default Strategy) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Demonstrates how the default strategy converts a JSON object with an array of scalars into a CSV format. It shows how scalar values along the path are included as columns. ```json {"a": 1, "b": [1, 2, 3], "c": ["a", "b", "c"]} ``` -------------------------------- ### Vectorized String Concatenation Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates the vectorized string concatenation function `s_mul(s: string, n: int) -> string`. It shows how the first argument is processed element-wise while the second argument, `len(@)`, references the entire input array or object. ```Jsonata s_mul(@, len(@)) ``` -------------------------------- ### Spread Operator for Function Arguments in jsontoolsnppplugin Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates the use of the spread operator (*) in jsontoolsnppplugin (v5.8+) to pass array elements as multiple arguments to a function. Shows an example with the 'zip' function and another with a nested structure. ```jsontoolsnppplugin zip(*j`[[1, 2], ["a", "b"], [true, false]]`) ``` ```jsontoolsnppplugin @.*->max_by(*@) ``` -------------------------------- ### JSON Parsing Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/most recent errors.txt This code snippet demonstrates a complex JSON object structure that was parsed by the JsonTools plugin. It includes various data types, Unicode characters, and comments, showcasing the parser's capabilities. ```json obj = /*foo*/ //bar {"a":  [1, 2, 3],  "b": {},  "Я草": [], "😀": [[100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112], [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113], [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,//😀 [113, 114]]],/*cömment*/"d":[{"o":"öyster"},"cät",#python "dog"],"e":false,//cömment "f":null}//baz ``` -------------------------------- ### RemesPath: Variable Reassignment and Function Name Conflicts Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Illustrates how to redefine variables in RemesPath and how variable names can coexist with function names. It also shows an example of variable reassignment without affecting the original variable due to a non-identity function. ```RemesPath var x = 1; var y = x; y = @ + 1; x ``` ```RemesPath var x = 1; var y = x + 0; y = @ + 1 ``` ```RemesPath var ifelse = blah; var s_len = s_len(ifelse); ifelse(s_len < 3, foo, bar) ``` -------------------------------- ### JSON to CSV Conversion Example (Default Strategy - Nested) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Illustrates the default strategy's ability to drill down into nested JSON structures to find tabular data. It shows how paths to scalar values within nested objects are used as column names. ```json [{"a": 1, "b": [1, 2, 3], "c": {"d": "y"}}, {"a": 2, "b": [4, 5, 6], "c": {"d": "z"}}] ``` -------------------------------- ### JSON to CSV RFC 4180 Escaping Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Provides an example of how special characters like quotes, newlines, and delimiters are handled in CSV output according to RFC 4180 standards, including escaping quote characters. ```text The JSON string "foo,\n\"bar\"" would become "foo,\n""bar""" (with an actual newline) in a CSV file with , as delimiter and " as quote character. ``` -------------------------------- ### Notepad++ Plugin Architecture Overview Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/PluginPackInfo.md Illustrates the interaction flow between a Notepad++ plugin, the Notepad++ application, the Scintilla editor, and the provided gateway classes (NotepadPlusPlusGateway, ScintillaGateway) for simplified access. It also shows the option for direct Win32 API interaction. ```Diagram +-----------+ +-----------+ | Scintilla | | Notepad++ | +-----------+ +-----------+ ^ ^ | | +--------+--------+----+------------+ | | | +------------------+ +----------------+ +-----------+ | ScintillaGateway | | NotepadGateway | | Win32 | +------------------+ +----------------+ +-----------+ ^ ^ ^ | | | +-----------------+---+----------------+ | +-----------+ | Plugin | +-----------+ ``` -------------------------------- ### Get Object Keys Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Returns an array containing all the keys present in a given object. ```python def keys(x): # Implementation details for getting keys pass ``` -------------------------------- ### Get Length of Array or Object Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Calculates the number of elements in an array or the number of key-value pairs in an object. ```python def len(x): # Implementation details for getting length pass ``` -------------------------------- ### Navigate JSON Tree Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Provides keyboard shortcuts for navigating the JSON tree viewer. These shortcuts allow for efficient interaction with the JSON data structure. ```Notepad++ Plugin Command Enter: Toggles selected node between expanded/collapsed. ``` ```Notepad++ Plugin Command Up/Down Arrow Keys: Navigate the tree. ``` ```Notepad++ Plugin Command Ctrl+Up: Selects the parent of the currently selected node. ``` ```Notepad++ Plugin Command Ctrl+Down: Selects the last direct child of the currently selected node. ``` ```Notepad++ Plugin Command Escape: Takes focus from the tree view back to the editor. ``` -------------------------------- ### Generate Integer Range Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md The 'range' function creates an array of integers. It supports specifying start, end, and step values for the sequence. ```javascript range(start: int, end: int = null, step: int = 1) -> array[int] Returns an array of integers. * If `end` and `step` are not supplied, return all the integers from 0 to start, excluding start. * So `range(3)` returns `[0, 1, 2]` * `range(-1)` returns `[]` because -1 is less than 0. * If `step` is not supplied, return all the integers from `start` to `end`, excluding `end`. * `range(3, 5)` returns `[3, 4]`. * `range(3, 1)` returns `[]` because 1 is less than 3. * If all arguments are supplied, return all the integers from `start` to `end`, incrementing by `step` each time. * `range(3, 1, -1)` returns `[3, 2]`. * `range(0, 6, 3)` returns `[0, 3]`. ``` -------------------------------- ### JSON Formatting: PPrint Style Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Shows JSON data formatted using the PPrint style, inspired by Python's pprint module, for readability. ```json { "algorithm": [ ["start", "each", "child", "on", "a", "new", "line"], ["if", "the", "line", "would", "have", "length", "at", "least", "80"], [ "follow", "this", "algorithm", ["starting", "from", "the", "beginning"] ], ["else", "print", "it", "out", "on", 1, "line"] ], "style": "PPrint", "useful": true } ``` -------------------------------- ### Sample JSON Data for JSON Tools Plugin Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md This JSON snippet represents a sample dataset used to demonstrate the functionality of the JSON Tools Notepad++ plugin. It includes an array of objects, each detailing city information such as contamination status, dates, names, and zone data. ```json [ { "cities": "BUS", "contaminated": true, "date": "", "names": "Bluds", "nums": NaN, "subzone": "a", "zone": 1 }, { "cities": "BUS", "contaminated": false, "date": "", "names": "Bluds", "nums": NaN, "subzone": "c", "zone": 1 }, { "cities": "FUDG", "contaminated": true, "date": "2020-12-13 12:00:00.00", "names": "dfsd", "nums": 0.5, "subzone": "c", "zone": 2 }, { "cities": "FUDG", "contaminated": false, "date": "2020-12-13 12:00:00.00", "names": "dfsd", "nums": 0.5, "subzone": "e", "zone": 2 }, { "cities": "YUNOB", "contaminated": true, "date": "2014-10-17 12:00:00.00", "names": "Kjond", "nums": 4.6, "subzone": "w", "zone": 5 } ] ``` -------------------------------- ### Get JSON Schema Type (JavaScript) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Returns the JSON Schema type name for a given value. This function was added in version 5.5.0. ```JavaScript function type(x) { // Returns the JSON Schema type name for x. return ""; } ``` -------------------------------- ### OPC UA Lamp Device Instance Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/testfiles/small/newlines_in_strings_json.txt Represents an OPC UA lamp device instance, including its 'switcher' and 'temperature' properties. It details the desired and reported values, along with metadata like timestamps and data types. Property visitors for OPC UA are also specified. ```JSON { "id": "lamp-opcua", "name": "lamp-opcua", "protocol": "opcua-lamp-opcua", "model": "opcua-model", "twins": [ { "propertyName": "switcher", "desired": { "value": "false", "metadata": { "timestamp": "1550049403598", "type": "boolean" } }, "reported": { "value": "true", "metadata": { "timestamp": "1655779193063", "type": "boolean" } } }, { "propertyName": "temperature", "desired": { "value": "" }, "reported": { "value": "17", "metadata": { "timestamp": "1655779193079", "type": "string" } } } ], "propertyVisitors": [ { "name": "temperature", "propertyName": "temperature", "modelName": "opcua-model", "protocol": "opcua", "visitorConfig": { "nodeID": "ns=3;i=2002" } }, { "name": "switcher", "propertyName": "switcher", "modelName": "opcua-model", "protocol": "opcua", "visitorConfig": { "nodeID": "ns=3;i=2003" } } ] } ``` -------------------------------- ### RemesPath: Indexing and Selecting Keys Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates various ways to index and select keys from JSON objects and arrays using RemesPath syntax, including dot notation, square brackets, slices, and multiple selections. ```RemesPath @ ``` ```RemesPath @[1] ``` ```RemesPath @[-4] ``` ```RemesPath @[:3] ``` ```RemesPath @[5::2] ``` ```RemesPath @[1, 5:8, -1] ``` ```RemesPath @.bar ``` ```RemesPath @[bar] ``` ```RemesPath @[foo, bar, baz] ``` ```RemesPath @.`bar` ``` ```RemesPath @[`bar`] ``` ```RemesPath @.`\`bar\`` ``` ```RemesPath @.a12 ``` ```RemesPath @._ ``` ```RemesPath @.a_1 ``` ```RemesPath @[`1_a`] ``` -------------------------------- ### Open JSON Tree Viewer Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Opens the JSON tree viewer to visualize the structure of a JSON file. This allows for easy navigation and inspection of JSON data. ```Notepad++ Plugin Command Plugins -> JsonTools -> "Open JSON tree viewer" ``` ```Notepad++ Plugin Command Ctrl+Alt+Shift+J ``` -------------------------------- ### OPC UA Protocol Configuration Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/testfiles/small/newlines_in_strings_json.txt Configures the OPC UA protocol for a lamp, specifying the server URL, authentication details (username, password, certificate), and security mode. It also includes common configurations like the remote certificate. ```JSON { "name": "opcua-lamp-opcua", "protocol": "opcua", "protocolConfig": { "url": "opc.tcp://192.168.137.100:4840/", "userName": "testuser", "password": "/ca/pass", "securityMode": "None", "certificate": "/ca/clientcert.pem", "privateKey": "/ca/clientkey.pem" }, "protocolCommonConfig": { "customizedValues": { "remoteCertificate": "/ca/servercert.pem" } } } ``` -------------------------------- ### RemesPath: Multi-Statement Query with Variable Assignment Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates assigning variables and executing a multi-statement query in RemesPath. It shows how variables are updated and how assignments affect subsequent operations and the input JSON. ```RemesPath var a = 1; var b = @[0]; var c = a + 2; b = @ * c; @[:][1] ``` -------------------------------- ### JSON to CSV Boolean Conversion Example Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Shows the effect of the 'Convert booleans to integers' option, where 'true' and 'false' are replaced by '1' and '0' respectively in the CSV output. ```json {"flag1": true, "flag2": false} ``` -------------------------------- ### JSON Formatting: Indent Pretty Print (2 spaces) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Illustrates JSON data formatted with an indentation of 2 spaces per level. ```json { "a": [ 1 ] } ``` -------------------------------- ### Get Unique Elements from Array (JavaScript) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Returns an array of unique elements from the input array. Optionally sorts the array in ascending order, which requires all elements to be comparable. ```JavaScript function unique(x, sorted = false) { // Returns an array of all the unique elements in x. // If sorted is true, sorts the array ascending. return []; } ``` -------------------------------- ### Get Object Key-Value Pairs Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Retrieves all key-value pairs from an object as an array of two-item subarrays. Note that object order is not guaranteed, so sorting might be necessary for consistent results. ```python def items(x): # Implementation details for getting items pass ``` -------------------------------- ### JSON Formatting: Unsorted Keys Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Illustrates JSON object keys in their original input order, demonstrating the behavior when key sorting is disabled. ```json {"C": 3, "BA": 2, "a": 1, "A": 2, "ba": 4, "c": 4} ``` -------------------------------- ### JSON Formatting: Minimal Whitespace Compression Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Shows JSON data with all unnecessary whitespace removed for maximum compression. ```json {"a":[1,2]} ``` -------------------------------- ### Stringify Iterables Example with Array (JSON) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Illustrates the behavior of the 'Stringify iterables' strategy when encountering a JSON object with an array as a value. Unlike 'No recursion' or 'Default', this strategy stringifies the entire array. ```JSON {"a": 1, "b": [1, 2, 3], "c": ["a", "b", "c"]} ``` -------------------------------- ### JSON Formatting: Indent Pretty Print (4 spaces) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Demonstrates the default pretty-print indentation of 4 spaces per level for JSON data. ```json { "a": [ 1 ] } ``` -------------------------------- ### Stringify Iterables Output Example (CSV) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Shows the tabularized output for a JSON array when using the 'Stringify iterables' strategy with a comma separator. Nested structures are represented as strings, with internal quotes escaped. ```text a,b,c 1,"[1, 2, 3]","{ ""d"": ""y"" }" 2,"[4, 5, 6]","{ ""d"": ""z"" }" ``` -------------------------------- ### JSON Formatting: Sorted Keys Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Shows JSON object keys sorted alphabetically, highlighting the unstable nature of the sort when case differs. ```json {"A": 2, "a": 1, "ba": 4, "BA": 2, "c": 4, "C": 3} ``` -------------------------------- ### Suppress Linter Prompt Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Starting from version 5.1.0, users can suppress the prompt that asks whether to display syntax errors caught by the linter when parsing documents with errors. This is controlled by the `offer_to_show_lint` setting. ```JSON { "offer_to_show_lint": false } ``` -------------------------------- ### Pretty-Print JSON File Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Restores the current JSON file to its original formatting with increased whitespace using the 'Pretty-print current JSON file' command. This enhances human readability. ```Notepad++ Plugin Command Ctrl+Alt+Shift+P ``` -------------------------------- ### Stringify Iterables Output Example with Array (CSV) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Presents the tabularized output for a JSON object containing an array value using the 'Stringify iterables' strategy. Each element of the array is treated as a separate row entry. ```text a,b,c 1,1,a 1,2,b 1,3,c ``` -------------------------------- ### Stringify Iterables Example (JSON) Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/json-to-csv.md Demonstrates how the 'Stringify iterables' strategy processes a JSON array containing nested objects and arrays. Non-scalar values like arrays and objects are converted to their string representations in the output. ```JSON [{"a": 1, "b": [1, 2, 3], "c": {"d": "y"}}, {"a": 2, "b": [4, 5, 6], "c": {"d": "z"}}] ``` -------------------------------- ### Customize JsonTools Toolbar Icons Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/README.md Customize the order and visibility of toolbar icons for JsonTools features like tree view, compress, pretty-print, and path to current position. The `toolbar_icons` setting uses a string mapping where each character represents an icon. ```Notepad++ Settings toolbar_icons: "cot" # Example: compress, path to current position, tree view toolbar_icons: "P" # Example: only pretty-print icon toolbar_icons: "A" # Example: no icons ``` -------------------------------- ### RemesPath Grammar - Loop Syntax Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath language spec.txt Details the syntax for loop constructs in RemesPath, including variable assignment, query execution, and loop termination. ```BNF LOOP := LOOP_VAR_ASSIGN SEMICOLON QUERY SEMICOLON LOOP_END | LOOP_VAR_ASSIGN SEMICOLON QUERY | LOOP_VAR_ASSIGN ``` -------------------------------- ### OPC UA Lamp Device Model Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/testfiles/small/newlines_in_strings_json.txt Defines the 'opcua-model' device model for an OPC UA lamp. It includes 'temperature' and 'switcher' properties with their respective data types, descriptions, access modes, and default values. ```JSON { "name": "opcua-model", "properties": [ { "name": "temperature", "dataType": "int", "description": "temperature\n in degree celsius", "accessMode": "ReadOnly", "defaultValue": 1, "minimum": 0, "maximum": 0 }, { "name": "switcher", "dataType": "boolean", "description": "turn\n on or turn off", "accessMode": "ReadWrite", "defaultValue": false } ] } ``` -------------------------------- ### Loop Variable Behavior in jsontoolsnppplugin Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Demonstrates how loop variables persist after a for loop and how the final value of a query is determined by the array iterated over if the loop is not properly closed. Includes an example query and its effect on a JSON object. ```jsontoolsnppplugin var a = @.a; var b = @.b; var b_maxlen = ``; for i = range(len(a)); var bval = at(b, i); bval = @ * at(a, i); var b_maxlen = ifelse(s_len(bval) > s_len(b_maxlen), bval, b_maxlen); end for; b_maxlen; ``` -------------------------------- ### Omitting Optional Function Arguments in jsontoolsnppplugin Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Explains the feature (v6.0+) allowing users to omit optional function arguments, including the last one, by leaving them empty instead of using 'null'. Provides examples of correct usage. ```jsontoolsnppplugin foo(1, , 2) ``` ```jsontoolsnppplugin foo(1, 2, ) ``` -------------------------------- ### RemesPath Projection with Function Chaining Source: https://github.com/molsonkiko/jsontoolsnppplugin/blob/main/docs/RemesPath.md Shows a projection using the `->` operator to chain function calls, applying length and string conversion with repetition. ```RemesPath @[:]->len(@)->(str(@)*@) ```