<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[double click on a JSON file >> Notepad++ should (auto-) run the well JSON formating]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have to handle a lot of JSON files. They are always “compressed”, without blanks and tabs. So far ok! With a double click (yes windows world), Notepad will be opened, file loaded (because I my setting file extension 2 linked application is to Notepad++) So far ok!</p>
<p dir="auto">There are different JSON plugins available. With a shortcut (or via the menu) I can run a well formated JSON (with tabs, LF/CR, etc). So far ok!</p>
<p dir="auto">I am looking for a option, that all new opened JSON files will directly (auto-) run the well formating of the JSON file.</p>
<p dir="auto">Is this possible?<br />
Thanks a lot in advance!</p>
<p dir="auto">Matthias.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/23571/double-click-on-a-json-file-notepad-should-auto-run-the-well-json-formating</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 15:41:52 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/23571.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Oct 2022 06:21:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to double click on a JSON file >> Notepad++ should (auto-) run the well JSON formating on Fri, 07 Oct 2022 08:31:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/matthiasbth" aria-label="Profile: MatthiasBTH">@<bdi>MatthiasBTH</bdi></a></p>
<p dir="auto">To solve your issue you need support by some kind of scripting plugin, for example <em>NppExec</em> plugin and its companion <em>NppEventExec</em>.</p>
<ol>
<li>Install <em>NppExec</em> and <em>NppEventExec</em> plugins using <em>Plugins Admin</em>.</li>
<li>After <em>Notepad++</em> has been restarted navigate to <code>(menu) Plugins -&gt; NppExec -&gt; Execute NppExec Script</code></li>
<li>In the dialog popping up enter the following script:</li>
</ol>
<pre><code class="language-Z">npp_console keep
npp_menucommand Path/To your JSON formatting plugin's/menu entry 
</code></pre>
<p dir="auto">If your are using for example <em>JSTool</em> plugin to format your JSON files, line 2 of the script above has to be <code>npp_menucommand Plugins/JSTool/JSFormat</code>. In case you are using <em>JsonTools</em> plugin, line 2 of the script above has to be <code>npp_menucommand Plugins/JsonTools/Pretty-print current JSON file</code>. <strong>Please note:</strong> The menu entry’s path is <strong>case sensitive</strong> and has to be <strong>localized</strong>. That means, if the <code>Plugins</code> menu has another name in your <em>Notepad++</em> UI language, you need to adapt the command accordingly.</p>
<ol start="4">
<li>Click button <code>Save</code>.</li>
<li>In the small dialog popping up enter <code>AutoFormatJson</code> as name for the script.</li>
<li>Click button <code>Save</code> to close the saving dialog.</li>
<li>Click button <code>Cancel</code> to close the script editing dialog.</li>
<li>Navigate to <code>(menu) Plugins -&gt; NppEventExec -&gt; Edit rules</code></li>
<li>In the toolbar at the left, click button <code>Add a new rule</code> (mouse-hover over the buttons to get their tooltip texts).</li>
<li>In the toolbar at the left, click button <code>Edit the selected rule</code>.</li>
<li>Create a new rule by entering the following data into the dialog popping up (<strong>Please note:</strong> The edit field <code>NppExec command</code> has to contain the name of the <em>NppExec</em> script you saved in step 5. Edit field <code>Regex</code> has to contain the following: <code>(?i).*\.json</code>):</li>
</ol>
<p dir="auto"><img src="/assets/uploads/files/1665128446265-a0ef2c92-f43c-4f8c-8777-243f69d2e55d-grafik.png" alt="a0ef2c92-f43c-4f8c-8777-243f69d2e55d-grafik.png" class=" img-fluid img-markdown" /></p>
<ol start="12">
<li>Click button <code>Apply</code> to close the rule editing dialog.</li>
<li>In plugin’s main dialog click button <code>Save</code> to save your changes.</li>
<li>Click button <code>Close</code> to close plugin’s main dialog.</li>
</ol>
<p dir="auto">Now you can load a JSON file and it should be pretty-printed automatically.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80366</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80366</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Fri, 07 Oct 2022 08:31:23 GMT</pubDate></item></channel></rss>