© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
34 replies
Kye

❔ Creating a json array and reading a specific property

Hello!

So i have a json file as followed
{
    "embeds": [
        {
            "embed1": {
                "title": "test number 1",
                "description": "test",
                "type": "rich",
                "color": 79376
            },
            "embed2": {
                "title": "test number 2",
                "description": "test",
                "type": "rich",
                "color": 79376
            },
            "embed3": {
                "title": "test number 3",
                "description": "test",
                "type": "rich",
                "color": 79376
            }
        }
    ]
}
{
    "embeds": [
        {
            "embed1": {
                "title": "test number 1",
                "description": "test",
                "type": "rich",
                "color": 79376
            },
            "embed2": {
                "title": "test number 2",
                "description": "test",
                "type": "rich",
                "color": 79376
            },
            "embed3": {
                "title": "test number 3",
                "description": "test",
                "type": "rich",
                "color": 79376
            }
        }
    ]
}


I want to read let's say everything from
embed1
embed1
as if it was its own file. The thing to consider is that it has to be a string since the parameter is a string since im reading it like this

var parseObj = (JObject)JsonConvert.DeserializeObject($"App/Data/Configuration/embed.json");

EmbedBuilderUtils.TryParse(parseObj.SelectToken("embeds[0].embed1").ToObject<string>(), out var builder);
var parseObj = (JObject)JsonConvert.DeserializeObject($"App/Data/Configuration/embed.json");

EmbedBuilderUtils.TryParse(parseObj.SelectToken("embeds[0].embed1").ToObject<string>(), out var builder);


I am getting this error and idk what to do...
Unexpected character encountered while parsing value: A. Path '', line 0, position 0.
Unexpected character encountered while parsing value: A. Path '', line 0, position 0.
.
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

Creating an Array of strings from a stringified JSON
C#CC# / help
4y ago
❔ Reading from a JSON file
C#CC# / help
3y ago
✅ Reading Secret.json
C#CC# / help
3y ago
❔ parse a single json property differently
C#CC# / help
4y ago