© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
17 replies
Scythe

❔ Sorting a JObject by child values

I have JSON being returned by an API that I'm trying to sort to find the most relevant result. Here's an example of the JSON

{
    "data": {
        "total": 2,
        "tracks": [
            {
                "id": 170778,
                "type": "0",
                "title": "Wicked Wonders",
                "playCount": 0,
                "rating": 0,
                "tags": []
            },
            {
                "id": 210755,
                "type": "0",
                "title": "The Wonders Of The Universe",
                "playCount": 1,
                "rating": 3,
                "tags": []
            }
        ]
    }
}
{
    "data": {
        "total": 2,
        "tracks": [
            {
                "id": 170778,
                "type": "0",
                "title": "Wicked Wonders",
                "playCount": 0,
                "rating": 0,
                "tags": []
            },
            {
                "id": 210755,
                "type": "0",
                "title": "The Wonders Of The Universe",
                "playCount": 1,
                "rating": 3,
                "tags": []
            }
        ]
    }
}


I need to work out which track is the most relevant which I was going to by comparing/sorting by playCount/rating values (So Wonders of the universe would be the preferred result above) but I'm struggling to find a good way to sort the track array by the child values.

Can someone point me in the right direction?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ sorting by version number
C#CC# / help
3y ago
❔ JObject find value
C#CC# / help
3y ago
✅ How to fill JObject?
C#CC# / help
3y ago
Group dictionary by values(?)
C#CC# / help
4y ago