Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ShivrajRath/jsonabc
Sorts JSON object alphabetically. It supports nested objects, arrays and collections. Works offline and beautifies JSON object too.
https://github.com/ShivrajRath/jsonabc
javascript json json-abc sort sorts-json utility
Last synced: 2 months ago
JSON representation
Sorts JSON object alphabetically. It supports nested objects, arrays and collections. Works offline and beautifies JSON object too.
- Host: GitHub
- URL: https://github.com/ShivrajRath/jsonabc
- Owner: ShivrajRath
- License: mit
- Created: 2016-05-28T18:22:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-06T20:55:44.000Z (8 months ago)
- Last Synced: 2024-10-31T09:12:11.148Z (2 months ago)
- Topics: javascript, json, json-abc, sort, sorts-json, utility
- Language: JavaScript
- Homepage: http://novicelab.org/jsonabc
- Size: 60.5 KB
- Stars: 149
- Watchers: 11
- Forks: 27
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - ShivrajRath/jsonabc - Sorts JSON object alphabetically. It supports nested objects, arrays and collections. Works offline and beautifies JSON object too. (JavaScript)
README
[![Build Status][travis-icon]][travis]
## JSON ABC
Sorts JSON object alphabetically. It supports nested objects, arrays and collections. Works offline and beautifies JSON object too.
### Try it (Demo)
[JSON ABC][]
### Supports
- Beautifies JSON
- Sorts Plain Objects, Collections, Arrays
- Has offline supports
- IE9+ Support
- Mobile/ Tablet friendly
- Sorting plain arrays is optional### Download
`npm install jsonabc`
### Usage
1. Used directly in Node:
```js
var myJsonAbc = require("jsonabc");
var sorted = myJsonAbc.sortObj({ c: 0, b: 1, a: 0 });
```
2. Built by Browserify, for directly inclusion in the browser:
```html
var output = jsonabc.sort(inputStr, noarray);
```### Example
It converts this
```json
{
"object": {
"b": 2,
"a": 1,
"d": 4,
"c": 3
},
"array": ["d", "1", "c", "a", "b"],
"collection": [
{
"b": 2,
"a": 1,
"d": 4,
"c": 3
},
{
"__b1": 2,
"__a2": 1,
"__d3": 4,
"__c4": 3
},
["d", "1", "c", "a", "b"]
]
}
```to this
```json
{
"array": ["1", "a", "b", "c", "d"],
"collection": [
["1", "a", "b", "c", "d"],
{
"__a2": 1,
"__b1": 2,
"__c4": 3,
"__d3": 4
},
{
"a": 1,
"b": 2,
"c": 3,
"d": 4
}
],
"object": {
"a": 1,
"b": 2,
"c": 3,
"d": 4
}
}
```---
License: [MIT][]
[json abc]: https://novicelab.org/jsonabc "JSON ABC online"
[travis-icon]: https://travis-ci.org/ShivrajRath/jsonabc.svg?branch=master
[travis]: https://travis-ci.org/ShivrajRath/jsonabc "Build status — Travis-CI"
[mit]: https://mit-license.org/2016?c=ShivrajRath