Giter Club home page Giter Club logo

jsonabc's Introduction

jsonabc's People

Contributors

cheazy avatar harshzalavadiya avatar nfreear avatar qalqi avatar shivrajrath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonabc's Issues

Sorting arrays with objects

There is an issue in your code, regarding sorting arrays that contain objects.
It could be fixed by firstly sorting those objects recursively, and then sorting array of them. Sorting array could be done by comparing json representation of each object.

Here is the fixed sortJSON function:

        function sortJSON(un) {
            if (isArray(un)) {
                var or = new Array();
                un.forEach(function(v, i) {
                    or[i] = sortJSON(v);
                });
                or = or.sort(function (a, b) {
                    a =  JSON.stringify(a);
                    b =  JSON.stringify(b);
                    return a < b ? -1 : (a > b ? 1 : 0);
                });
                return or;
            } else if (isPlainObject(un)) {
                var or = {};
                Object.keys(un).sort().forEach(function(key) {
                    or[key] = sortJSON(un[key]);
                });
                return or;
            }

            return un;
        }

Should arrays be sorted?

I believe (at least according to the API responses I have worked with) only dict keys should be sorted not the arrays. As sometimes, order of arrays matter for the end user and by sorting it is messed up. Or at least it should be optional. Any thoughts???

bundling failed: Error: While trying to resolve module `jsonabc` [react-native]

The package xxx\jsonabc\package.json was successfully found.
However, this package itself specifies a main module field that could not be resolved (xxx\node_modules\jsonabc\dist\jsonabc.js. Indeed, none of these files exist:
xxx\jsonabc\dist\jsonabc.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

Error in react-native

Getting "Incorrect JSON Object" when running locally

I downloaded everything so I could run it locally, but I'm getting an "Incorrect JSON Object" on the below JSON (running it online works just fine). Any suggestions would be greatly appreciated!

Thanks,
Sam

{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

Standalone fails without net connection

I appreciate that your utility can be run standalone, but I am disturbed that a standalone function is calling Google Analytics and Google Syndication. I get error messages if I am not connected to the net. That kind of defeats the concept of "standalone".

Could you please identify if your utility is actually dependent on any of those external sites?

Thanks.

Issue when sorting numbers

The code base sorts array of numbers as array of text.

Input :
{
"a": [
3,4,22,33,99
]
}

Output :
{
"a": [
22,
3,
33,
4,
99
]
}

Support for JSON5

I love this extension! But I noticed that jsonAbc.sortObj removes comments from JSON5 files. Would it be possible to keep these during sorting?

Input:

{
  // XYZ
  "xyz": "xyz",
  // ABC
  "abc": "abc"
}

Current Output:

{
  "abc": "abc",
  "xyz": "xyz"
}

Expected Output:

{
  // ABC
  "abc": "abc",
  // XYZ
  "xyz": "xyz"
}

case insensitive sorting

I think the case for sorting should be ignored, otherwise we get something like this:
"Admin": {
"ALREADY_EXISTS": "Already Exists",
"INVALID_DATA": "Invalid Data",
"Users": "Users",
"addUsers": "Add User",
"btnClose": "Close",
"userPopUpTitle": "Edit user",
"user_Name": "Email"
}
or at least give the option to disable it. thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.