New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

good-sort-json

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-sort-json

Sort json the good way


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created

good-sort-json

Sort json the good way.

json is sorted as follows: literals, objects, arrays and then alphabetically.

Example

const jsonSort = require("good-sort-json");
console.log(jsonSort({
    id: "asdf",
    health: 98,
    weapons: [{
        type: "thrust",
        damage: 57,
    }],
    alarms: ["12.30pm"],
    armor: {
        resistance: [{ type: "thrust", value: 100 }],
        type: "leather",
    },
}));

outputs

{
  "health": 98,
  "id": "asdf",
  "armor": {
    "type": "leather",
    "resistance": [
      {
        "type": "thrust",
        "value": 100
      }
    ]
  },
  "alarms": [
    "12.30pm"
  ],
  "weapons": [
    {
      "damage": 57,
      "type": "thrust"
    }
  ]
}

Keywords

FAQs

Package last updated on 21 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts