private static void WriteJsonDocument(IArchiveEntry entry, object value) { using var zipStream = entry.OpenWrite(); using var sr = new StreamWriter(zipStream); using var writer = new JsonTextWriter(sr); var serializer = new JsonSerializer(); serializer.Serialize(writer, value); }
public override void BuildResource(IResource resource, IArchiveEntry contentEntry) { var serializer = new JsonSerializer() { Formatting = Formatting.None }; JObject document; using (var sr = new StreamReader(resource.Content.LoadStream())) using (var reader = new JsonTextReader(sr)) { document = serializer.Deserialize <JObject>(reader); } using var zipStream = contentEntry.OpenWrite(); using var streamWriter = new StreamWriter(zipStream); serializer.Serialize(streamWriter, document); }