Community
    • Login

    JSON String Escape / Unescape

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    11 Posts 7 Posters 16.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Gioacchino PiazzollaG
      Gioacchino Piazzolla
      last edited by

      Hi, I sometimes use this website to escape/unescape a string containing a json.
      It is really useful for development purposes.

      Do you know if there is a plugin that does the same thing?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Gioacchino Piazzolla
        last edited by

        @Gioacchino-Piazzolla

        Please don’t open a DUPLICATE thread.

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @Alan Kilborn
          last edited by

          Actually, the thread isn’t the duplicate thing. It’s just that you posted this same posting in another existing thread.
          Be assured that others will read that earlier posting and respond to it, as indeed we have (check the other thread).

          1 Reply Last reply Reply Quote 0
          • prahladmifourP
            prahladmifour
            last edited by

            Hello,@Gioacchino-Piazzolla
            Please follow these steps, To JSON String Escape / Unescape
            Step 1: Download the jN plugin.
            Step 2: Place files from Zip to Plugin folder of Notepad++ in C:\Programs Files\Notepad++\plugins.
            Step 3: Save Code below as URLENDECODE.js and save it to C:\Program Files\Notepad++\plugins\jN\includes.
            Step 4: Restart Notepad++.
            Code:

            var URLDecoderEncoder = Editor.addMenu('URL-Encoding/Decoding');
            URLDecoderEncoder.addItem({
                text: 'Encode',
                cmd: function() {
                    var unencoded = Editor.currentView.text;
                    var encoded = encodeURIComponent(unencoded);
                    Editor.currentView.text = encoded;
                }
            });
            URLDecoderEncoder.addItem({
                text: 'Decode',
                cmd: function() {
                    var encoded = Editor.currentView.text;
                    var unencoded = decodeURIComponent(encoded);
                    Editor.currentView.text = unencoded;
                }
            });
            URLDecoderEncoder.addItem({
                text: 'Decode multi-pass (7x)',
                cmd: function() {
                    var encoded = Editor.currentView.text;
                    var unencoded_pass1 = decodeURIComponent(encoded);
                    var unencoded_pass2 = decodeURIComponent(unencoded_pass1);
                    var unencoded_pass3 = decodeURIComponent(unencoded_pass2);
                    var unencoded_pass4 = decodeURIComponent(unencoded_pass3);
                    var unencoded_pass5 = decodeURIComponent(unencoded_pass4);
                    var unencoded_pass6 = decodeURIComponent(unencoded_pass5);
                    var unencoded = decodeURIComponent(unencoded_pass6);
                    Editor.currentView.text = unencoded;
                }
            });
            

            I hope this information will be useful to you.
            Thank you.

            Ilia NenashevI 1 Reply Last reply Reply Quote 0
            • Ilia NenashevI
              Ilia Nenashev @prahladmifour
              last edited by

              It is very nice example of using jN plugin to extend Notepad++ features, but Your example decode/encode URL instead of JSON’s strings.

              Sorry for reply at old post, but now I have similar task as had topicstarter and I think if anyone will found this topic like me will be appreciated to ability to find here a right solution.

              PeterJonesP 1 Reply Last reply Reply Quote 1
              • PeterJonesP
                PeterJones @Ilia Nenashev
                last edited by

                @Ilia-Nenashev said in JSON String Escape / Unescape:

                I think if anyone will found this topic like me will be appreciated to ability to find here a right solution.

                @Mark-Olson’s JSONTools plugin (which was first developed in 2022, so a couple years after this discussion) has the ability to easily escape/unescape JSON strings, and many other useful tools for JSON manipulation.

                Ilia NenashevI 1 Reply Last reply Reply Quote 3
                • Ilia NenashevI
                  Ilia Nenashev @PeterJones
                  last edited by

                  I do not see any related command there :-(

                  cd9221ba-6665-4be8-bd94-46e28027f402-image.png

                  Such possibility I have found only in https://github.com/RolandTaverner/npp-json-escape-unescape-plugin but there is some risk of installing compiled plugin from outside of community.

                  Mark OlsonM 1 Reply Last reply Reply Quote 0
                  • Mark OlsonM
                    Mark Olson @Ilia Nenashev
                    last edited by Mark Olson

                    @Ilia-Nenashev
                    You’re using an old version of JsonTools that doesn’t have it.
                    Try installing the latest release.

                    I’d also like to note that JsonTools has a very detailed and regularly updated Changelog, so in general you should always be able to see when a certain feature was added.

                    Artem RepkoA 1 Reply Last reply Reply Quote 3
                    • Artem RepkoA
                      Artem Repko @Mark Olson
                      last edited by

                      @Mark-Olson said in JSON String Escape / Unescape:

                      @Ilia-Nenashev
                      You’re using an old version of JsonTools that doesn’t have it.
                      Try installing the latest release.

                      I’d also like to note that JsonTools has a very detailed and regularly updated Changelog, so in general you should always be able to see when a certain feature was added.

                      Could you please provide the name of the action of this plugin to (un)escape text/JSON. I have the latest version (8.1) and can’t find.

                      PeterJonesP Mark OlsonM 2 Replies Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Artem Repko
                        last edited by PeterJones

                        @Артем-Репко said in JSON String Escape / Unescape:

                        I have the latest version (8.1)

                        per the ChangeLog, v8.1 was released in Aug 2024; the most-recent release of that plugin was v8.4.0 released in May 2025.

                        But the feature you are looking for has existed since v6.1 in December 2023 or earlier, per the Dec 2023 message (above) from the author of the plugin.

                        Could you please provide the name of the action of this plugin to (un)escape text/JSON.

                        • escape text = Plugins > JsonTools > Dump selected text as JSON string(s): convert the highlighted text into a JSON string, including adding any necessary escapes.
                          • For example, start with
                            This string has "quotes and 'apostrophes' and \backslashes"
                            
                          • Select that whole line, and use the command, which will result in a fully-formed JSON string, complete with wrapping quotes:
                            "This string has \"quotes and 'apostrophes' and \\backslashes\""
                            
                        • unescape text = Plugins > JsonTools > Dump JSON string(s) as raw text: interpret the highlighted text as one or more JSON strings, and convert it back to raw text:
                          • Select the second line from above, run the command, to get back the original
                            This string has "quotes and 'apostrophes' and \backslashes"
                            
                        1 Reply Last reply Reply Quote 2
                        • Mark OlsonM
                          Mark Olson @Artem Repko
                          last edited by

                          @Artem-Repko
                          @PeterJones correctly pointed to the D&ump selected text as JSON string(s) and Dump JSON string(s) as ra&w text commands in JsonTools. I just wanted to add this comment because I just added new documentation for both of those commands.

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors