C
C#15mo ago
malkav

✅ Familiarity with `YamlDotNet` package, parsing to strongly typed object keeps failing

So I have this .md to .yaml parser written, and a package that parses a yaml into a .NET object class, however it keeps telling me the properties cannot be found. For example, when I parse with the example class shown in https://dotnetfiddle.net/k1d6I2 my fiddle. The method I use for parsing is in there too. However, when I try to parse a markdown file:
---
title: FP Config
hero_settings:
title: my title
subtitle: test meuk
button_text: mail
client_header:
title: clients
subtitle: of us
clients: []
services_header:
title: services
subtitle: services
expertise_header:
title: expertise
subtitle: stuff
about_header:
title: about
subtitle: about
about:
- leadmct: true
mct: true
mvp: true
title: bryce
subtitle: manager
image: url.to/image/path.png
partnerships_header:
title: partnerships
subtitle: partners
---
---
title: FP Config
hero_settings:
title: my title
subtitle: test meuk
button_text: mail
client_header:
title: clients
subtitle: of us
clients: []
services_header:
title: services
subtitle: services
expertise_header:
title: expertise
subtitle: stuff
about_header:
title: about
subtitle: about
about:
- leadmct: true
mct: true
mvp: true
title: bryce
subtitle: manager
image: url.to/image/path.png
partnerships_header:
title: partnerships
subtitle: partners
---
I get the following error:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Property 'hero_settings' not found on type 'My.Namespace.Data.FrontPageSettings'.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Property 'hero_settings' not found on type 'My.Namespace.Data.FrontPageSettings'.
Can anyone help me out here? Or is there an easier way to parse .md files into JSON instead? (not using a console application, like this git linkhttps://github.com/markjulmar/MarkdownToJson
1 Reply