Community
    • Login

    [New plugin] JSON escape/unescape plugin

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    2 Posts 2 Posters 4.6k Views 1 Watching
    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.
    • R Offline
      Roland Taverner
      last edited by

      Just finished (kinda) my first Notepad++ plugin. It has just 3 functions:

      • Escape (no surprises)
      • Unescape (no surprises)
      • Recursive unescape

      The first two are trivial, the second is interesting (at least for me because I have to work with large JSONs on daily basis). Recursive unescape scans JSON for string fields and tries to convert them to JSON objects. For example:

      {"a": "{\"b\":\"{\\\"c\\\": \\\"value\\\"}\"}"} => {"a":{"b":{"c":"value"}}}
      

      It is useful when you have to read some JSONs like

      {
          "events": [
              {
                  "event": "1",
                  "data": "{\"a\":\"string\"}"
              },
              {
                  "event": "2",
                  "data": "{\"b\":\"string\", \"c\":42}"
              }
          ]
      }
      

      Recursive unescape transforms it to

      {
          "events": [
              {
                  "data": {
                      "a": "string"
                  },
                  "event": "1"
              },
              {
                  "data": {
                      "b": "string",
                      "c": 42
                  },
                  "event": "2"
              }
          ]
      }
      

      Source code: https://github.com/RolandTaverner/npp-json-escape-unescape-plugin
      Hope it will be useful not for me only. Also I will be grateful for feedback.
      PS Right now it supports UTF8 only, will fix it ASAP.

      ? 1 Reply Last reply Reply Quote 5
      • ? Offline
        A Former User @Roland Taverner
        last edited by

        @Alexander-Verbitsky Congratulations!

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors