[New plugin] JSON escape/unescape plugin
-
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. -
@Alexander-Verbitsky Congratulations!
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