This package has been deprecated

Author message:

Package no longer maintained

good-sort-json

0.2.1 • Public • Published

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"
    }
  ]
}

Readme

Keywords

Package Sidebar

Install

npm i good-sort-json

Weekly Downloads

0

Version

0.2.1

License

ISC

Unpacked Size

3.22 kB

Total Files

4

Last publish

Collaborators

  • danielpanpm