如何在记事本++中格式化JSON

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45286154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 18:58:02  来源:igfitidea点击:

How to format JSON in notepad++

jsonnotepad++

提问by Unbreakable

I want to format JSON String in notepad++. Kindly guide me how to do so. I looked into this solution Notepad ++ JSON Format. It tells me to download the a tool from This web site. But I don't know which link to click out of 4 mentioned in that web site. Also, I just randomly downloaded one of the zip file and then unzipped it and it shows one dll file. Now what to do with that dll. Can some one guide me as I am a complete beginner. I have windows 10 running on my PC

我想在记事本++中格式化JSON字符串。请指导我如何这样做。我研究了这个解决方案Notepad ++ JSON Format。它告诉我从这个网站下载一个工具。但我不知道该网站中提到的 4 个链接中应该点击哪个链接。另外,我只是随机下载了一个 zip 文件,然后解压缩它,它显示了一个 dll 文件。现在如何处理该 dll。有人可以指导我,因为我是一个完整的初学者。我的 PC 上运行的是 Windows 10

EDIT 1Some people are in so much hurry to give negative points. May be some people want to see code snippet even for this question. Huh!

编辑 1有些人非常着急给负分。可能有些人甚至希望看到这个问题的代码片段。哼!

EDIT 2Anyways I tried below and IT DID NOT WORK

编辑 2无论如何,我在下面尝试过,但没有奏效

enter image description here

在此处输入图片说明

This is how my notepad ++ looks like after installing them.

这是我的记事本 ++安装后的样子。

enter image description here

在此处输入图片说明

EDIT 3Ok I fixed the issue. The problem is if you select multiple plugins together (multiple checkboxes) and install them there seems to be some issue with notepad++, so the solution for me was to install the plugin individually.

编辑 3好的,我解决了这个问题。问题是,如果您一起选择多个插件(多个复选框)并安装它们,notepad++ 似乎存在一些问题,因此我的解决方案是单独安装插件。

采纳答案by Kiril

You have to use the plugin manager of Notepad++ and search for the JSON plugin. There you can easily install it.

您必须使用 Notepad++ 的插件管理器并搜索 JSON 插件。在那里您可以轻松安装它。

This answer explains it pretty good: How to reformat JSON in Notepad++?

这个答案很好地解释了它:How to reformat JSON in Notepad++?

回答by Always Sunny

Try with JSToolNppand follow the snap like this then Plugins | JSTool | JSFormat.

尝试使用 JSToolNpp并按照这样的快照然后插件 | JS工具| JS格式。

enter image description here

在此处输入图片说明

回答by JRG

Here are the steps to install JSToolNPPplugin on your notepad++.

以下是在JSToolNPP记事本++上安装插件的步骤。

  • STEP 1:I downloaded 64bit version from your link. Download 32bit version if you are on 32-bit OS.

    64bit - JSToolNPP.1.21.0.uni.64.zip: Download from SourceForget.net

  • STEP 2:notepad++ before installation

  • STEP 1:我从您的链接下载了 64 位版本。如果您使用的是 32 位操作系统,请下载 32 位版本。

    64 位 - JSToolNPP.1.21.0.uni.64.zip:从 SourceForget.net 下载

  • STEP 2:安装前记事本++

enter image description here

在此处输入图片说明

  • STEP 3:Unzip the downloaded JSToolNPP.1.21.0.uni.64and copy the JSMinNPP.dlland place it under C:\Program Files\Notepad++\plugins

  • STEP 4:Close notepad++ and reopen it. If you have downloaded incompatible dll then it will complain else it will open successfully. If it complains about incompatibility, go back to STEP 1 and download the correct bit version as per your OS. Check Plugins in notepad++

  • STEP 3:解压下载JSToolNPP.1.21.0.uni.64并复制JSMinNPP.dll并放置在C:\Program Files\Notepad++\plugins

  • STEP 4:关闭记事本++并重新打开它。如果您下载了不兼容的 dll,那么它会抱怨,否则它将成功打开。如果它抱怨不兼容,请返回第 1 步并根据您的操作系统下载正确的位版本。在记事本++中检查插件

enter image description here

在此处输入图片说明

  • STEP 5:Paste a sample unformatted but valid JSON data in notepad++ ()

  • STEP 6:Select all text in notepad++ (CTRL+A)and format using Plugins -> JSTool -> JSFormat

  • STEP 5:在记事本++中粘贴一个未格式化但有效的JSON数据示例()

  • STEP 6:选择记事本++中的所有文本(CTRL+A)并使用格式化Plugins -> JSTool -> JSFormat

enter image description here

在此处输入图片说明

NOTE:On side note, if you do not want to install any plugins like this, I would recommend to use following 2 best online formatter.

NOTE:附带说明一下,如果您不想安装任何这样的插件,我建议您使用以下 2 个最佳在线格式化程序。

回答by Ziggler

I was unable to find JSTool. Please see below url to see how I installed Notepad++

我找不到 JSTool。请参阅以下网址以了解我如何安装 Notepad++

How to view Plugin Manager in Notepad++

如何在 Notepad++ 中查看插件管理器

I created JSMinNPP folder in C:\Program Files (x86)\Notepad++\plugins and copied JSMinNPP to it.

我在 C:\Program Files (x86)\Notepad++\plugins 中创建了 JSMinNPP 文件夹并将 JSMinNPP 复制到它。

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by Jenna Leaf

Always google so you can locate the latest package for both NPP and NPP Plugins.

始终使用 google,以便您可以找到 NPP 和 NPP 插件的最新包。

I googled "notepad++ 64bit". Downloaded the free latest version at Notepad++ (64-bit) - Free download and software. Installed notepad++ by double-click on npp.?.?.?.Installer.x64.exe, installed the .exe to default Windows 64bit pathwhich is, "C:\Program Files".

我在谷歌上搜索了“notepad++ 64bit”。在Notepad++(64 位)下载免费的最新版本- 免费下载和软件。通过双击npp.?.?.?.Installer.x64.exe安装notepad++ ,将.exe 安装到默认的Windows 64 位路径,即“ C:\Program Files”。

Then, I googled "notepad++ 64 json viewer plug". Knowing SourceForge.Net is a renowned download site, downloaded JSToolNpp [email protected]. I unzipped and copied JSMinNPP.dllto notePad++ root dir.

然后,我在谷歌上搜索了“notepad++ 64 json viewer plug”。知道 SourceForge.Net 是一个著名的下载站点,下载JSToolNpp [email protected]。我解压并复制JSMinNPP.dll到 notePad++ 根目录。

I loaded my newly installed notepad++ 64bit. I went to Settingsand selected [import plug-in]. I pointed to the location of JSMinNPP.dlland clicked open.

我加载了我新安装的记事本++ 64位。我去设置并选择了[导入插件]。我指向JSMinNPP.dll所在的位置,点击打开。

I reloaded notepad++, went to PlugInsmenu. To format one-line json string to multi-line json doc, I clicked JSTool->JSFormator reverse multi-line json doc to one-line json string by JSTool->JSMin(json-Minified)!

我重新加载了记事本++,转到插件菜单。要将一行 json 字符串格式化为多行 json doc,我单击JSTool->JSFormat或通过JSTool->JSMin(json-Minified) 将多行 json doc 逆向为一行 json 字符串!

All items are in this picture.

所有物品都在这张照片中。

回答by Unbreakable

The answer was to install the plugin individually. I installed all the three plugins shown in the screenshot together. And it created the issue. I had to install each plugin individually and then it worked fine. I am able to format the JSON string.

答案是单独安装插件。我将屏幕截图中显示的所有三个插件安装在一起。它创造了这个问题。我必须单独安装每个插件,然后才能正常工作。我能够格式化 JSON 字符串。