I am currently writing a web app that lets you create flash cards on the fly. In order to create these I manually create a .apkg
file. Unfortunately the imports fails due to a JSON error:
anki.errors.LocalizedError: JsonError("expected value at line 1 column 2")
Even after continuous effort I was not able to trace down where the error stems from. I copied the model
, decks
, conf
and dconf
JSON objects from an existing deck that uses the same model as the web app. I do not have media files and thus set the contents of the media
file to {}
.
Please see the JSON objects in question:
Summary
`
const conf = {“collapseTime”:1200,“_deck_0_lastNotetype”:1657413686850,“schedVer”:2,“newSpread”:0,“curDeck”:1,“activeDecks”:[1],“dueCounts”:true,“nextPos”:2,“estTimes”:true,“timeLim”:0,“sortBackwards”:false,“creationOffset”:-540,“_nt_1657413686850_lastDeck”:0,“sortType”:“noteFld”,“dayLearnFirst”:false,“curModel”:1657413686850,“addToCur”:true}
const model = {“1657413686850”:{“id”:1657413686850,“name”:“Basic”,“type”:0,“mod”:0,“usn”:0,“sortf”:0,“did”:null,“tmpls”:[{“name”:“Card 1”,“ord”:0,“qfmt”:“{{Front}}”,“afmt”:“{{FrontSide}}\n\n
\n\n{{Back}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0}],“flds”:[{“name”:“Front”,“ord”:0,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Back”,“ord”:1,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”}],“css”:“.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n”,“latexPre”:“\documentclass[12pt]{article}\n\special{papersize=3in,5in}\n\usepackage[utf8]{inputenc}\n\usepackage{amssymb,amsmath}\n\pagestyle{empty}\n\setlength{\parindent}{0in}\n\begin{document}\n”,“latexPost”:“\end{document}”,“latexsvg”:false,“req”:[[0,“any”,[0]]]},“1657413686854”:{“id”:1657413686854,“name”:“Cloze”,“type”:1,“mod”:0,“usn”:0,“sortf”:0,“did”:null,“tmpls”:[{“name”:“Cloze”,“ord”:0,“qfmt”:“{{cloze:Text}}”,“afmt”:“{{cloze:Text}}
\n{{Back Extra}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0}],“flds”:[{“name”:“Text”,“ord”:0,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Back Extra”,“ord”:1,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”}],“css”:“.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n.cloze {\n font-weight: bold;\n color: blue;\n}\n.nightMode .cloze {\n color: lightblue;\n}\n”,“latexPre”:“\documentclass[12pt]{article}\n\special{papersize=3in,5in}\n\usepackage[utf8]{inputenc}\n\usepackage{amssymb,amsmath}\n\pagestyle{empty}\n\setlength{\parindent}{0in}\n\begin{document}\n”,“latexPost”:“\end{document}”,“latexsvg”:false,“req”:[[0,“any”,[0]]]},“1657413686852”:{“id”:1657413686852,“name”:“Basic (optional reversed card)”,“type”:0,“mod”:0,“usn”:0,“sortf”:0,“did”:null,“tmpls”:[{“name”:“Card 1”,“ord”:0,“qfmt”:“{{Front}}”,“afmt”:“{{FrontSide}}\n\n
\n\n{{Back}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0},{“name”:“Card 2”,“ord”:1,“qfmt”:“{{#Add Reverse}}{{Back}}{{/Add Reverse}}”,“afmt”:“{{FrontSide}}\n\n
\n\n{{Front}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0}],“flds”:[{“name”:“Front”,“ord”:0,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Back”,“ord”:1,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Add Reverse”,“ord”:2,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”}],“css”:“.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n”,“latexPre”:“\documentclass[12pt]{article}\n\special{papersize=3in,5in}\n\usepackage[utf8]{inputenc}\n\usepackage{amssymb,amsmath}\n\pagestyle{empty}\n\setlength{\parindent}{0in}\n\begin{document}\n”,“latexPost”:“\end{document}”,“latexsvg”:false,“req”:[[0,“any”,[0]],[1,“all”,[1,2]]]},“1657413686851”:{“id”:1657413686851,“name”:“Basic (and reversed card)”,“type”:0,“mod”:0,“usn”:0,“sortf”:0,“did”:null,“tmpls”:[{“name”:“Card 1”,“ord”:0,“qfmt”:“{{Front}}”,“afmt”:“{{FrontSide}}\n\n
\n\n{{Back}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0},{“name”:“Card 2”,“ord”:1,“qfmt”:“{{Back}}”,“afmt”:“{{FrontSide}}\n\n
\n\n{{Front}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0}],“flds”:[{“name”:“Front”,“ord”:0,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Back”,“ord”:1,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”}],“css”:“.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n”,“latexPre”:“\documentclass[12pt]{article}\n\special{papersize=3in,5in}\n\usepackage[utf8]{inputenc}\n\usepackage{amssymb,amsmath}\n\pagestyle{empty}\n\setlength{\parindent}{0in}\n\begin{document}\n”,“latexPost”:“\end{document}”,“latexsvg”:false,“req”:[[0,“any”,[0]],[1,“any”,[1]]]},“1657413686853”:{“id”:1657413686853,“name”:“Basic (type in the answer)”,“type”:0,“mod”:0,“usn”:0,“sortf”:0,“did”:null,“tmpls”:[{“name”:“Card 1”,“ord”:0,“qfmt”:“{{Front}}\n\n{{type:Back}}”,“afmt”:“{{Front}}\n\n
\n\n{{type:Back}}”,“bqfmt”:“”,“bafmt”:“”,“did”:null,“bfont”:“”,“bsize”:0}],“flds”:[{“name”:“Front”,“ord”:0,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”},{“name”:“Back”,“ord”:1,“sticky”:false,“rtl”:false,“font”:“Arial”,“size”:20,“description”:“”}],“css”:“.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n”,“latexPre”:“\documentclass[12pt]{article}\n\special{papersize=3in,5in}\n\usepackage[utf8]{inputenc}\n\usepackage{amssymb,amsmath}\n\pagestyle{empty}\n\setlength{\parindent}{0in}\n\begin{document}\n”,“latexPost”:“\end{document}”,“latexsvg”:false,“req”:[[0,“any”,[0,1]]]}}
const deck = {“1”:{“id”:1,“mod”:0,“name”:“Default”,“usn”:0,“lrnToday”:[0,0],“revToday”:[0,0],“newToday”:[0,0],“timeToday”:[0,0],“collapsed”:true,“browserCollapsed”:true,“desc”:“”,“dyn”:0,“conf”:1,“extendNew”:0,“extendRev”:0}}
const dconf = {“1”:{“id”:1,“mod”:0,“name”:“Default”,“usn”:0,“maxTaken”:60,“autoplay”:true,“timer”:0,“replayq”:true,“new”:{“bury”:false,“delays”:[1.0,10.0],“initialFactor”:2500,“ints”:[1,4,0],“order”:1,“perDay”:20},“rev”:{“bury”:false,“ease4”:1.3,“ivlFct”:1.0,“maxIvl”:36500,“perDay”:200,“hardFactor”:1.2},“lapse”:{“delays”:[10.0],“leechAction”:1,“leechFails”:8,“minInt”:1,“mult”:0.0},“dyn”:false,“newMix”:0,“newPerDayMinimum”:0,“interdayLearningMix”:0,“reviewOrder”:0,“newSortOrder”:0,“newGatherPriority”:0,“buryInterdayLearning”:false}}
`
Due to some html and JS usage these are quite convoluted and I suggest you view them in a text editor or an online JSON formatter.
As always thanks in advance!