Convert CSL-JSON to BibTeX
This is the reverse of a BibTeX-to-CSL-JSON conversion: it takes CSL-JSON — the
format used by Pandoc and citeproc — and produces BibTeX entries you can
use directly with LaTeX. It is handy when a collaborator sends a .json bibliography
but your document is built with bibtex or biber.
How it works
The tool parses the JSON (accepting either an array of items or a single object),
then walks each CSL item. The CSL type chooses the BibTeX entry type
(article-journal→@article, paper-conference→@inproceedings, thesis→@phdthesis,
and so on). Variables are mapped back to fields: title→title, container-title→journal
or booktitle, volume→volume, issue→number, page→pages (with - rewritten as the
LaTeX --), DOI→doi, publisher→publisher.
Author and editor arrays are rebuilt into Family, Given strings joined with and.
The issued date-parts array supplies the year (and month if present). Special
characters such as &, % and _ are escaped so the resulting .bib compiles
cleanly under LaTeX.
Notes
If a CSL item lacks an id, a cite key is synthesised from the first author’s family
name and the year (for example Smith2021). Page ranges are normalised to the LaTeX
double-hyphen en-dash form (3--17) regardless of how they were written in the input.