Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting by data type. Grouping Primitive data type together and Complex data type together. #66

Open
maxime4000 opened this issue Apr 21, 2022 · 2 comments

Comments

@maxime4000
Copy link

I'm looking at the documentation and I'm not sure how to interpret the docs about the settings configuration. I'm looking to sort JSON by Type, but I want it with those criteria :

  • Primitive data type first
    • Sorting without grouping primitive type. (string, number and others will be mixed together in the sorting)
  • Complex data type second

I guess I have 4 criteria of grouping. Something like this order :

  • primitive (string, number, boolean, null, undefined)
  • array of primitive ex: ["str1", "str2", 3, null, true, false]->No Object in this array
  • object
  • array of object or mixed data ex: [{...}, "2", {...}, 4, null, {...}, true, false]

The goal is to make :

  • Simple data first
  • Array of simple data second
  • Complex data third
  • Array of complex data fourth/last

To my understanding, the most similar feature is sorting by type, but it separate different primitive type which I prefer if it wouldn't happen.

I don't think the settings allow this type of customization, would appreciate some help if it can allow it. Otherwise, take this as a feature request :)

@maxime4000
Copy link
Author

Here a JSON made to test the use case:
I can provide with an expected sorting if ask. Otherwise I won't.

{
  "F": "string",
  "B": {
    "B": "string",
    "A": "string",
    "AObject": {
      "E": "string",
      "O": 3,
      "W": null,
      "H": 1,
      "B": false,
      "BObject": {
        "A": "string",
        "G": "string",
        "H": [
          {
            "C": "string",
            "A": "string"
          },
          {
            "C": "string",
            "A": {
              "A": "string"
            }
          }
        ],
        "B": {
          "A": "string"
        },
        "F": true,
        "D": {
          "A": "string",
          "D": "string",
          "C": "string"
        },
        "C": {
          "A": "string"
        },
        "E": "string"
      },
      "N": null,
      "ZObject": {
        "A": "string",
        "M": "string",
        "C": "string"
      },
      "M": "string",
      "L": 2,
      "D": "string",
      "R": false,
      "T": true,
      "C": "string"
    },
    "ZObject": {
      "A": "string",
      "G": "string",
      "D": "string",
      "C": "string"
    },
    "CObject": {
      "G": "string",
      "B": "string",
      "M": "string",
    }
  },
  "A": {
    "A": "string",
    "G": "string",
    "M": "string",
    "C": "string"
  },
  "C": {
    "A": "string",
    "G": "string",
    "M": "string",
    "C": "string"
  }
}

@richie5um
Copy link
Owner

Thanks for the suggestion. I'm not able to have a look at this at the moment. Let me know if you are able to have a look at the code and I can give you some suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants