[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!