Skip to content
fardhanardhiPublic

About

๐Ÿงผ A simple CLI tool to deeply unescape nested escaped JSON strings inside JSON objects โ€” perfect for debugging messy API responses.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

jesc

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.

โœจ Features

  • ๐Ÿ”„ 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

๐Ÿ“ฆ Installation

MacOS & Linux

brew tap fardhanardhi/jesc
brew install jesc

Windows

See releases page.

๐Ÿš€ Usage

With direct json string

jesc "<your-json-string>"

With input json file path

jesc --file "<your-json-filepath>"

Optional flags

  • -f, --format: Format output JSON with indentation (pretty print)
  • --output: Output filepath

Example

Input (escaped JSON inside JSON string)

{
  "name": "John Doe",
  "hobbies": "[{\"name\":\"climbing\",\"isFavorite\":true}]",
  "esc": "{\"a\":3,\"b\":\"haha\",\"c\":\"{\\\"deep\\\":true}\"}"
}

Command

Direct json string with print output
jesc '{"name":"John Doe","hobbies":"[{\"name\":\"climbing\",\"isFavorite\":true}]","esc":"{\"a\":3,\"b\":\"haha\",\"c\":\"{\\\"deep\\\":true}\"}"}' -f
Json file with print output
jesc --input input.json -f
Json file with file output
jesc --input input.json --output output.json -f

Output

{
  "name": "John Doe",
  "hobbies": [
    {
      "name": "climbing",
      "isFavorite": true
    }
  ],
  "esc": {
    "a": 3,
    "b": "haha",
    "c": {
      "deep": true
    }
  }
}

๐Ÿง  How It Works

Internally, jesc:

  1. Parses the top-level JSON string.
  2. 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.
  3. Outputs the final cleaned and structured JSON.

๐Ÿ”จ Building

Clone the repository and build it using Go:

git clone https://github.com/fardhanardhi/jesc.git
cd jesc
go build

๐Ÿ“„ License

The project is licensed under the MIT License.

About

๐Ÿงผ A simple CLI tool to deeply unescape nested escaped JSON strings inside JSON objects โ€” perfect for debugging messy API responses.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages