Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy Text To JsonNew to Visual Studio Code? Get it now.
Copy Text To Json

Copy Text To Json

roman_123

|
161 installs
| (1) | Free
Copy text into JSON through mouse or keyboard operation
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Text To Json

通过拷贝粘贴的方式将JavaScript对象的文本转换为Json格式的一个扩展应用

[TOC]

使用方法

  • 在编辑器中选中文本点击鼠标右键选择(Copy To Json)或按下键盘(ctrl+shift+c)将选中的文本拷贝成JSON格式,粘贴文本内容(ctrl+v)
  • 在外部或编辑器中拷贝文本(ctrl+c),使用鼠标右键选择(Paste To Json)或按下键盘(ctrl+shift+v)将拷贝的内容粘贴为JSON格式
  • 可在[首选项-设置-扩展-CopyTextToJson]设置输出JSON的缩进,默认为2个字符
  • 注意: 如果拷贝的文本转换JSON失败,会输出原始文本

键盘映射

快捷键 功能说明
cmd-shift-c or ctrl-shift-c 将选中的文本拷贝成JSON格式
cmd-shift-v or ctrl-shift-v 将选中的文本粘贴成JSON格式

This extension can convert JavaScript object text to JSON format by copying

Usage

  • Select the text in the editor, right-click and select (Copy To Json), or press the keyboard (ctrl+shift+c) to copy the selected text into JSON format and paste the text content (ctrl+v)
  • Copy text from outside or in editor (ctrl+c), right-click and select (Paste To Json) or press the keyboard (ctrl+shift+v) to paste the copied content into JSON format
  • You can set the indentation of the output JSON in [Preferences-Settings-Extension-CopyTextToJson], which defaults to 2 characters
  • Warn: If the copied text fails to convert to JSON, the original text will be output

Keybindings

Shortcuts Functionality
cmd-shift-c or ctrl-shift-c Copy the selected text into JSON
cmd-shift-v or ctrl-shift-v Paste the selected text into JSON

Example(示例)

Example1

// 在vsCode编辑器中选中数据,使用ctrl+shift+c快捷键拷贝(Select the data in the vsCode editor and use the Ctrl+Shift+C shortcut to copy it)
{
	a: 1,
	b: 'example'
}
// 粘贴结果(Paste result)
{
	"a": 1,
	"b": "example"
}

Example2

// 拷贝数据(Copy data)
{
	a: 1,
	b: 'example'
}
// 在vsCode编辑器中使用ctrl+shift+v快捷键粘贴(Use the Ctrl+shift+v shortcut to paste in the vsCode editor)
{
	"a": 1,
	"b": "example"
}

Example3

// 拷贝数据(Copy data)
a: 1, b: 'example'
// 在vsCode编辑器中使用ctrl+shift+v快捷键粘贴(Use the Ctrl+shift+v shortcut to paste in the vsCode editor)
{
	"a": 1,
	"b": "example"
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft