jesc is a lightweight CLI tool that recursively unescapes deeply nested and escaped JSON strings within a JSON object. It's especially useful when you're dealing with messy JSON blobs where some fields are double, triple, or even more levels of string-encoded JSON.
- ๐ Recursively unescapes deeply nested escaped JSON strings
- โ
Supports unescaping both objects (
{}) and arrays ([]) - ๐งช Optional pretty-formatting for better readability
- ๐ ๏ธ Simple CLI interface
- ๐ Great for debugging or cleaning up bad API responses
brew tap fardhanardhi/jesc
brew install jescSee releases page.
jesc "<your-json-string>"jesc --file "<your-json-filepath>"-f,--format: Format output JSON with indentation (pretty print)--output: Output filepath
{
"name": "John Doe",
"hobbies": "[{\"name\":\"climbing\",\"isFavorite\":true}]",
"esc": "{\"a\":3,\"b\":\"haha\",\"c\":\"{\\\"deep\\\":true}\"}"
}jesc '{"name":"John Doe","hobbies":"[{\"name\":\"climbing\",\"isFavorite\":true}]","esc":"{\"a\":3,\"b\":\"haha\",\"c\":\"{\\\"deep\\\":true}\"}"}' -fjesc --input input.json -fjesc --input input.json --output output.json -f{
"name": "John Doe",
"hobbies": [
{
"name": "climbing",
"isFavorite": true
}
],
"esc": {
"a": 3,
"b": "haha",
"c": {
"deep": true
}
}
}Internally, jesc:
- Parses the top-level JSON string.
- Iterates each field:
- If the value is a string that looks like JSON, it attempts to unmarshal it.
- Repeats recursively for any successfully unmarshaled map.
- Outputs the final cleaned and structured JSON.
Clone the repository and build it using Go:
git clone https://github.com/fardhanardhi/jesc.git
cd jesc
go buildThe project is licensed under the MIT License.