© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
37 replies
Kye

Parse embed from Json into EmbedBuilderUtils

Hello! :D

For my own convenience and to not clog up my entire class file with endless amounts of lines. I created a json file that holds numerous of preset embeds that I wanna use. However, I'm stuck on an issue and I certainly cannot seem to figure out the issue whatsoever.

{
  "embeds": {
    "first_embed": {
      "title": "First Embed",
      "description": "This is the description for the first embed.",
      "color": 16711680,
      "author": {
        "name": "Author Name",
      },
      "footer": {
        "text": "Footer Text"
      }
    },
    "second_embed": {
      "title": "Second Embed",
      "description": "This is the description for the second embed.",
      "color": 16711680
    }
  }
}
{
  "embeds": {
    "first_embed": {
      "title": "First Embed",
      "description": "This is the description for the first embed.",
      "color": 16711680,
      "author": {
        "name": "Author Name",
      },
      "footer": {
        "text": "Footer Text"
      }
    },
    "second_embed": {
      "title": "Second Embed",
      "description": "This is the description for the second embed.",
      "color": 16711680
    }
  }
}


i simply want to parse the embed into a utility that is named EmbedBuilderUtils which is provided by Discord.NET. It basically goes like this

_ = EmbedBuilderUtils.TryParse(Configuration.GetSection("embeds").GetValue<string>("first_embed"), out var builder);

await ReplyAsync(null, false, embed: builder.Build());
_ = EmbedBuilderUtils.TryParse(Configuration.GetSection("embeds").GetValue<string>("first_embed"), out var builder);

await ReplyAsync(null, false, embed: builder.Build());


This should technically speaking work? unless there is another way to parse first_embed's object entirely. I'm quite lost on this. Any help is appreciated!
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

JSON Parse Help
C#CC# / help
4y ago
how do i parse json into a class?
C#CC# / help
4y ago
Parse Rust Enum Json in C#
C#CC# / help
3y ago