Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 4x 4x 4x 5x 5x 5x 1x | import { z } from 'zod' import { Question, QuestionSchema } from '../question' import { QuestionFormat } from './format' /** * JSON encoded format of {@link Question} */ export const json: QuestionFormat = { fileType: 'application/json', fileExtension: 'json', import: (text: string): Question[] => { const data = JSON.parse(text) const schema = z.array(QuestionSchema) return schema.parse(data) }, export: (questions: Question[]) => { return JSON.stringify(questions, null, 2) }, } |