C
C#•13mo ago
Pannekoekje

Serialize value of property only

Given this code: https://dotnetfiddle.net/C3Pt3C How would I only serialize the value of the "TempType" rather than the whole object?
C# Online Compiler | .NET Fiddle
Test your C# code online with .NET Fiddle code editor.
13 Replies
Unknown User
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Pannekoekje
PannekoekjeOP•13mo ago
I should've made the example better
Pannekoekje
PannekoekjeOP•13mo ago
C# Online Compiler | .NET Fiddle
Test your C# code online with .NET Fiddle code editor.
Unknown User
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Pannekoekje
PannekoekjeOP•13mo ago
Sorry
Pannekoekje
PannekoekjeOP•13mo ago
C# Online Compiler | .NET Fiddle
Test your C# code online with .NET Fiddle code editor.
Unknown User
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Pannekoekje
PannekoekjeOP•13mo ago
Why wouldn't I?
Unknown User
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Pannekoekje
PannekoekjeOP•13mo ago
I understand that, but I thought combining the JsonPropertyName + Value of the variable would be possible
Unknown User
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Sir Rufo
Sir Rufo•13mo ago
It can be done with a custom JsonConverter
Pannekoekje
PannekoekjeOP•13mo ago
I'm doing it another way, thx 🙂

Did you find this page helpful?