sunjw / jstoolnpp

A JavaScript (JSON) tool for Notepad++ (formerly JSMinNpp) and Visual Studio Code.
GNU General Public License v2.0
284 stars 24 forks source link

Convert JS object to JSON #154

Closed ygoe closed 5 months ago

ygoe commented 5 months ago

Today I needed to have a JSON file and was copying the data from a JS file. I didn't notice that the quotes around the property names were missing until my JSON parser said it can't handle that file. I was looking for such an option in this plugin but couldn't find one. So I had to find the nearest online tool for this task.

It would be great if this plugin could also convert between JS and JSON. This mostly means adding/removing quotes around property names. Removing of course only where possible.

sunjw commented 5 months ago

From JS to JSON, I think you can use the JSON sort function in this plugin. From JSON to JS, JSON object is already a JS object (with strict code format rule), why bother to do this? Thanks anyway.