© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
12 replies
Brady Kelly

❔ How can I query a JSON doc for only objects with a specific property value?

I have a JSON object that looks like this:
{
    "pagedata": [
        {
            "id": "settings_tab_1",
            "data": {
                "oneSetting": {
                    "id": "InitialExperience",
                    "value": "1505209",
                    "options": [
                        {
                            "value": "option1"
                        }
                    ]
                },
                ...
        },
        {
            "id": "settings_tab_5",
            "data": {
                "someOtherSetting": {
                    "id": "ResultSortOrder",
                    "value": "1064235",
                    "options" [
                        {
                            "value": "option1"
                        }
                    ]                
                },
                ...
            }
        }
    ],
    "selectedTabId": "settings_tab_5",
    "statuscode": "OK",
    "props": {
        "type": "settings",
        "baseurl": "/settings"
    }
}
{
    "pagedata": [
        {
            "id": "settings_tab_1",
            "data": {
                "oneSetting": {
                    "id": "InitialExperience",
                    "value": "1505209",
                    "options": [
                        {
                            "value": "option1"
                        }
                    ]
                },
                ...
        },
        {
            "id": "settings_tab_5",
            "data": {
                "someOtherSetting": {
                    "id": "ResultSortOrder",
                    "value": "1064235",
                    "options" [
                        {
                            "value": "option1"
                        }
                    ]                
                },
                ...
            }
        }
    ],
    "selectedTabId": "settings_tab_5",
    "statuscode": "OK",
    "props": {
        "type": "settings",
        "baseurl": "/settings"
    }
}

The
pagedata
pagedata
array here has two items, with
id
id
values of
settings_tab_1
settings_tab_1
and
settings_tab_5
settings_tab_5
. How could I extract a version of this JSON with only one
pagedata
pagedata
item, the one with an
id
id
value of
settings_tab_5
settings_tab_5
?
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

❔ Setting a property for only specific MenuItems
C#CC# / help
4y ago
Serialize value of property only
C#CC# / help
3y ago
✅ How can I filter for only JSON ModelState errors?
C#CC# / help
4mo ago