Closed
Conversation
- Add json_marshal.c3 with Go-style API (json::marshal, json::marshal_value, json::marshal_array) - Support all primitive types: String, int, float, double, bool - Support enums (always marshaled as enum names, regardless of associated values) - Support nested structs and arrays of any supported type - Use temp allocator for memory-safe operation - Comprehensive test suite with 15 test cases covering all features - Follow C3 coding style with proper and kindof usage
- Extract common marshaling logic into marshal_value function - Simplify marshal() to use marshal_value for all struct fields - Simplify marshal_array() to use marshal_value for all array elements - Add array/slice support to marshal_value function - Reduce code duplication by ~60 lines while maintaining all functionality - All existing tests continue to pass
- Add unmarshal() function to convert JSON strings to structs - Support for all primitive types (int, float, bool, String) - Support for enums (by name lookup) - Support for nested structs - Support for arrays and slices - Strict type checking with appropriate JSON number handling - Comprehensive test coverage with 40 passing tests - Clean API design following Go-style naming conventions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is based on #2255, not sure github is able to handle stacked PRs.