如何让 Notepad++ 正确格式化、“漂亮打印”未格式化的 JSON 数据

Mad*_*hem 13 notepad++

对缺乏术语等表示歉意。

我想改变这样一行无尽的行:

{"GameDataObjects":[{"$type":"Game.GameData.AttributeGameData, Assembly-CSharp","DebugName":"Constitution","ID":"72712dca-8f95-42ef-bca1-be2e99f69de3","Components":[{"$type":"Game.GameData.AttributeComponent, Assembly-CSharp","Type" ... ...
Run Code Online (Sandbox Code Playgroud)

让它看起来像这样:

{
  "GameDataObjects": [
    {
      "$type": "Game.GameData.GlobalGameSettingsGameData, Assembly-CSharp",
      "DebugName": "GlobalGameSettings",
      "ID": "eddfc852-ccb9-4884-b901-e77e8ca31b48",
      "Components": [
        {
          "$type": "Game.GameData.CharacterStatsSettingsComponent, Assembly-CSharp",
          "BasePlayerLevelCap": 20,
          "MaxCharacterLevel": 30,
          "AttributeAverage": 10,
          "MaxPerceptionDistance": 7,
          "MaxStealthRadius": 4,
          "DefaultWalkSpeed": 2,
          "DefaultRunSpeed": 4,
          "DefaultAnimalCompanionWalkSpeed": 2,
          "DefaultAnimalCompanionRunSpeed": 5.5,
          "CombatHealthRechargeRate": 1,
          "NormalHealthRechargeRate": 10,
          "HealthRechargeDelay": 3,
          "ModalRecoveryTime": 3,
          "HitMultiplier": 1,
Run Code Online (Sandbox Code Playgroud)

小智 13

您需要在 NotePad++ 中安装 JSON Viewer 插件。插件 > 插件管理器 > JSON 查看器 > 安装。插件安装后,选择要格式化的文本,然后单击插件 > JSON 查看器 > 格式化 JSON。

签出最新版本的 Notepad++ 以获取所有更新和最新的插件。

  • 为了完整起见,SO 中的首选解决方案是 JSTool(也可以从插件管理器获得)。显然,JSON Viewer 可以做所有事情,甚至更多。 (2认同)