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.
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
42Posts
36Comments
22Connections
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
- Machine Learning Engineer (multiple positions available)SAP · Full time · Palo Alto, CA
- Sr. DevOps Engineer (multiple positions available)SAP · Full time · Newtown Square, PA
- DevOps Engineer (Multiple Positions Available)SAP · Full time · Palo Alto, CA
Commenters (This Week)
Mike Dabydeen
10 comments
seaneboneslang
6 comments
vansharora0821
2 comments
Contribute meaningful comments to climb the leaderboard and earn badges!