MCPcopy Index your code
hub / github.com/codeaashu/claude-code / toJSON

Function toJSON

web/lib/export/json.ts:25–45  ·  view source on GitHub ↗
(conv: Conversation, options: ExportOptions)

Source from the content-addressed store, hash-verified

23}
24
25export function toJSON(conv: Conversation, options: ExportOptions): string {
26 let messages = conv.messages;
27
28 if (options.dateRange) {
29 const { start, end } = options.dateRange;
30 messages = messages.filter((m) => m.createdAt >= start && m.createdAt <= end);
31 }
32
33 const output = {
34 id: conv.id,
35 title: conv.title,
36 model: conv.model,
37 createdAt: options.includeTimestamps ? conv.createdAt : undefined,
38 updatedAt: options.includeTimestamps ? conv.updatedAt : undefined,
39 messageCount: messages.length,
40 messages: messages.map((m) => filterMessage(m, options)),
41 exportedAt: new Date().toISOString(),
42 };
43
44 return JSON.stringify(output, null, 2);
45}

Callers 1

POSTFunction · 0.90

Calls 1

filterMessageFunction · 0.85

Tested by

no test coverage detected