New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON <=> Javascript stringifier / parser #61
Comments
Hi there 👋 Can you elaborate on what would a "JSON stringifier" do or provide an example input/output? Thanks! |
Sure For example, I’m using a plugin called headwind that allows for custom regex configuration. I need to write the regex, and then stringify it. Input:
Output:
I also stringify when debugging requests with postman or insomnia, as I send JSON payloads a lot. The input can be a string, boolean, number, array, or object from JavaScript (as well as special types like undefined, null, regex, dates, and more too). I’ve been using tools like: But it’d be great to have it in DevUtils 😄 |
Ah I see, thanks for elaborating. For stringifier, if I understand it correctly, it means you want to escape the reserved character in a JSON string, right? Do you think the existing tool "Backslash Escape/Unescape" can do it? For example: Can you test it out with a few cases and let me know if it gives the desired output? I'll consider updating the tool name/description to make it more friendly (maybe add a "stringifier" keyword to the description). As for JSON Parser, the existing tool also allow you to see if there is any syntax error. Screenshot: Is there a more specific case you are looking to use that the current JSON Format/Validate tool doesn't support? |
Not quite, the main goal is converting the aforementioned JSON <=> Javascript. So both a stringifier and a parser. The datatypes are normally objects and arrays, but also strings, booleans, numbers, null, and others. The Backslash Escape/Unescape also doesn’t handle edge cases like converting undefined to null. It’s also soooooo much more convenient to just copy pasta my entire clipboard rather than find and convert specific lines with the Backslash Escape/Unescape tool (when working with requests, for example). Sure, the JSON Format/Validate tool will tell me that a JavaScript object is not JSON, but that’s not nearly as helpful as having a JavaScript to JSON converter actually convert it for me. |
I see. This is well noted :) Thanks for the suggestion! |
Often times, whether it’s debugging requests or setting up json configs, I kept wishing I had this little utility.
Related #48. But in addition to a parser, also a stringifier
The text was updated successfully, but these errors were encountered: