The main thing with JSON in C is handling malformed input safely. Are you also checking for missing fields and unexpected types?
Tuesday Coding Tip 26 — JSON (de)serialization in C#
2 Comments
nate
•
Jakub Neruda
•
@[nate] Unexpected types throw exceptions. And I make my JSONs permissive for missing fields by initializing them to sensible defaults. So far I didn't need recovery from unexpected types, but you should be able to handle these with custom serialization helpers (that can be injected into both system.text.json and newtonsoft.json)
Please log in to add a comment.
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
chevron_left
35Posts
35Comments
21Connections
Experienced C++ developer, team lead and hobby gamedev. I enjoy writing stuff about C++, clean code, clean architecture, and game development.
More From Jakub Neruda
Related Jobs
- DevOps Engineers (multiple openings) to 230k - FS Polystanleyreid · Full time · Maryland
- Retail Sales Associate Spanish BilingualVerizon · Full time · Germany
- Spanish Bilingual Appointment Setter Work From HomeInsurance Protection Specialists · Full time · Puerto Rico
Commenters (This Week)
raylabs
8 comments
m-o-z-z-i-x
1 comment
CodeWithRomi
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!