Vscode extension making conversion between yaml and json fast and simple
MIT License
Easily convert YAML to JSON or vice versa. Conversion can be done by each individual file or by all files in a folder.
Any good ideas or feature requests? Please, do not hesitate to open a new issue!
Convert a single file:
Convert to JSON
..json
.Convert to YAML
..yaml
or .yml
.Convert selection as preview:
YAML+JSON: Preview as JSON (from YAML. Opens in new file)
YAML+JSON: Preview as YAML (from JSON. Opens in new file)
Convert text selection:
Convert selection to JSON
- does not change file extension.Convert selection to YAML
- does not change file extension.Converting multiple files:
Convert selected files to YAML
.Convert selected files to JSON
.Convert YAML files to JSON
.Convert JSON files to YAML
.Reverting converted files: When a file has been reverted, a "revert" prompt will be shown to revert it. Using this will return the entirety of the original file, including YAML comments.
Overwriting existent files: When trying to convert a file into a destination that already exist, you can use the overwriteExistentFiles
configuration to overwrite such. Notice if you use the revert feature after overwriting a file, the extension cannot (currently) revert the overwritten file. Also, due to limitation in vscode of active user prompts, if you set it to "ask"
you will only be prompted to overwrite N number of files, while others will be skipped.
All configurations should be defined in yaml-plus-json
in vscode settings (e.g. .vscode/settings.json
), like:
{
"yaml-plus-json": {
"convertOnRename": true,
"yamlIndent": 2,
"fileExtensions": {
"yaml": ".yaml",
"json": ".json"
}
}
}
id | description | type | default | example |
---|---|---|---|---|
convertOnRename |
Convert YAML/JSON files on rename | boolean | true |
false |
yamlIndent |
The number of spaces to use when indenting code (yaml) | number | 2 |
4 |
yamlSchema |
See yaml module documentation for details | string | "core" |
"json" |
fileExtensions |
define what filename extension(s) to use when converting file(s) | object | ||
fileExtensions.yaml |
yaml filename extension | string | ".yaml" |
".yml" |
fileExtensions.json |
json filename extension | string | ".json" |
".json" |
keepOriginalFiles |
Keep original files when converting. Use "ask" to be asked every time or "always" to always keep original files |
string | "always" |
|
overwriteExistentFiles |
Overwrite existent files when converting. Use "ask" to be asked every time or "always" to always overwrite |
string | "always" |