Skip to content

Conversation

@dbrattli
Copy link
Collaborator

Summary

  • Refactors JSON serialization to use a static Json class with method overloads instead of standalone functions
  • Adds Json.dumps, Json.dump, Json.loads, Json.load static methods with various overloads
  • Updates tests to use the new Json class pattern with additional coverage for records and unions

API

Json.dumps(obj)                              // basic serialization
Json.dumps(obj, indent = 2)                  // with indentation  
Json.dumps(obj, separators, ensureAscii)     // custom formatting
Json.dump(obj, fp)                           // file serialization
Json.loads(s)                                // deserialization (native Python types)
Json.load(fp)                                // file deserialization

Test plan

  • All existing tests pass
  • New tests for records and union types added
  • just test-python passes (196 tests)

🤖 Generated with Claude Code

dbrattli and others added 2 commits December 18, 2025 21:51
Refactor JSON serialization to use a static `Json` class with method overloads
instead of standalone functions. This provides a cleaner API with:

- `Json.dumps(obj)` - basic serialization with fableDefault
- `Json.dumps(obj, indent)` - with indentation
- `Json.dumps(obj, separators, ensureAscii)` - with custom formatting
- `Json.dump(obj, fp)` - file serialization
- `Json.loads(s)` / `Json.load(fp)` - deserialization (returns native Python types)

The fableDefault handler automatically converts Fable numeric types (Int8-64,
UInt8-64, Float32/64), unions, and records to JSON-serializable Python types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dbrattli dbrattli merged commit 1eb5005 into main Dec 18, 2025
2 checks passed
@dbrattli dbrattli deleted the feat/json-static-class branch December 18, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants