1.1.2 • Published 8 months ago

@tamtamchik/json-deep-sort v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

JSON Deep Sort

Buy Me A Coffee Latest Version on NPM Scrutinizer build Scrutinizer quality Scrutinizer coverage Software License Total Downloads

JSON Deep Sort is a comprehensive package that provides flexible sorting of JSON objects by keys. This TypeScript-written package can handle deeply nested objects and arrays, and offers both synchronous and asynchronous operations.

Installation

Using npm:

npm install @tamtamchik/json-deep-sort

Using yarn:

yarn add @tamtamchik/json-deep-sort

Usage

Import JSON Deep Sort in your TypeScript file:

import { sort } from '@tamtamchik/json-deep-sort';

Here is an example of sorting a JSON object:

let data = {
    b: 'b',
    a: 'a',
    c: {
        d: 'd',
        c: 'c',
        a: 'a',
        b: 'b'
    }
};

let sortedData = sort(data, true);
// { a: 'a', b: 'b', c: { a: 'a', b: 'b', c: 'c', d: 'd' } }

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

JSON Deep Sort is MIT licensed.