Reputation: 1746
I have output that looks like a JSON
object and would like to pretty print it. I have the plugin to pretty print it but I can only do so if the output has double quotes in the words, which my output doesn't (see example below). Is there a way to do so with regex provided by Visual Studio Code or do I have to learn how to get a script to do this for me?
{a: b, c: [], d: {e: f} }
Desired output:
{"a": "b", "c": [], "d": {"e": "f"} }
Which vscode-json:Beautify
can pretty print later provide indentation like:
{
"a": "b",
"c": [],
"d": {
"e": "f"
}
}
Upvotes: 1
Views: 3460
Reputation: 390
To achieve this, you can simply select the Regular Expression and
then search for
".*."
Upvotes: 1
Reputation: 4127
In VSCode Search and Replace:
\w+
for the search argument
"$0"
for the replace argument
and press "replace all"
Upvotes: 5