Skip to content

Commit 5f82106

Browse files
ooplesclaude
andcommitted
fix: replace System.Text.Json with Newtonsoft.Json in DistillationCheckpointManager
Resolves review comment on DistillationCheckpointManager.cs:417 - Removed System.Text.Json using directive - Added Newtonsoft.Json using directive - Replaced all JsonSerializer calls with JsonConvert.SerializeObject/DeserializeObject - Used Formatting.Indented instead of JsonSerializerOptions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a568592 commit 5f82106

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/KnowledgeDistillation/DistillationCheckpointManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using AiDotNet.Interfaces;
22
using AiDotNet.KnowledgeDistillation.Strategies;
3-
using System.Text.Json;
3+
using Newtonsoft.Json;
44

55
namespace AiDotNet.KnowledgeDistillation;
66

@@ -188,7 +188,7 @@ private void SaveCheckpoint(
188188
if (_config.SaveMetadata)
189189
{
190190
string metadataPath = basePath + ".metadata.json";
191-
var json = JsonSerializer.Serialize(metadata, new JsonSerializerOptions { WriteIndented = true });
191+
var json = JsonConvert.SerializeObject(metadata, Formatting.Indented);
192192
File.WriteAllText(metadataPath, json);
193193
}
194194
}
@@ -391,7 +391,7 @@ private void SaveStrategyState(string path, object strategy)
391391
TotalSteps = curriculum.TotalSteps
392392
};
393393

394-
var json = JsonSerializer.Serialize(state, new JsonSerializerOptions { WriteIndented = true });
394+
var json = JsonConvert.SerializeObject(state, Formatting.Indented);
395395
File.WriteAllText(path, json);
396396
}
397397
}
@@ -402,7 +402,7 @@ private void LoadExistingCheckpointMetadata()
402402
if (File.Exists(metadataIndexPath))
403403
{
404404
var json = File.ReadAllText(metadataIndexPath);
405-
var checkpoints = JsonSerializer.Deserialize<List<CheckpointMetadata>>(json);
405+
var checkpoints = JsonConvert.DeserializeObject<List<CheckpointMetadata>>(json);
406406
if (checkpoints != null)
407407
{
408408
_savedCheckpoints.AddRange(checkpoints);
@@ -413,7 +413,7 @@ private void LoadExistingCheckpointMetadata()
413413
private void SaveCheckpointMetadata()
414414
{
415415
string metadataIndexPath = Path.Combine(_config.CheckpointDirectory, "checkpoint_index.json");
416-
var json = JsonSerializer.Serialize(_savedCheckpoints, new JsonSerializerOptions { WriteIndented = true });
416+
var json = JsonConvert.SerializeObject(_savedCheckpoints, Formatting.Indented);
417417
File.WriteAllText(metadataIndexPath, json);
418418
}
419419
}

0 commit comments

Comments
 (0)