- strip beginning/ending single or double quotes
^([^:]*): (?:["'])?(.*?)(?:["'])?$
$1: $2
- replace quotes around KEYS with placeholders, if the key has quotes, preserve indents
^(\s*)(?:["'])([^:]*?)(?:["'])?: (.*)$
$1###$2###: $3
- replace all remaining unescaped double quotes with escaped double quotes
([^\\])"
$1\"
- replace placeholders around quote keys with quotes
^(\s*)###([^:]*?)###?: (.*)$
$1"$2": $3
- add double quotes around all values
^([^:]*): (.*)$
$1: "$2"