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

How to sort based on key-value which is nested array. #2

Open
upen4a3 opened this issue Oct 29, 2020 · 0 comments
Open

How to sort based on key-value which is nested array. #2

upen4a3 opened this issue Oct 29, 2020 · 0 comments

Comments

@upen4a3
Copy link

upen4a3 commented Oct 29, 2020

Hey thanks for the great code.I am able to sort json using your code.But it was unable to sort when i have key-value which is nested .

For Example:

{
  "Actors": [
    {
      "name": "Tom Cruise",
      "age": 56,
      "Born At": "Syracuse, NY",
      "Birthdate": "July 3, 1962",
      "photo": "https://jsonformatter.org/img/tom-cruise.jpg",
      "wife": null,
      "weight": 67.5,
      "hasChildren": true,
      "hasGreyHair": false
    },
    {
      "name": "Robert Downey Jr.",
      "age": 53,
      "Born At": "New York City, NY",
      "Birthdate": "April 4, 1965",
      "photo": "https://jsonformatter.org/img/Robert-Downey-Jr.jpg",
      "wife": "Susan Downey",
      "weight": 77.1,
      "hasChildren": true,
      "hasGreyHair": false,
      "children": [
        {
          "name":"Tom",
           "age":15
        },
        {
          "name":"Jerry",
          "age":17
        }
      ]
    }
  ]
}

I would like to sort based children[I].name.

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

1 participant