Skip to main content

Convert a JSON document to LaTeX commands

Project description

📝 json2tex - Convert JSON to LaTeX

pipeline status coverage report documentation

This Python script can read multiple JSON files, merge them and outputs LaTeX-\newcommand-definitions to access all elements.

Installation

# from PyPI
pip install json2tex
# or directly from GitLab
pip install git+https://gitlab.com/nobodyinperson/json2tex

Usage

With a JSON file values.json like this:

[
  {
    "_id": "5f1570db9d5aa0b6df3823f8",
    "index": 0,
    "guid": "0fdfb3c5-1f0a-4c2a-8fed-75861742b588",
    "isActive": true,
    "balance": "$1,652.14",
    "picture": "http://placehold.it/32x32",
    "age": 22,
    "eyeColor": "blue",
    "name": {
      "first": "Harrington",
      "last": "Emerson"
    },
    "company": "ISOSURE"
  }
]

(generated with JSONGenerator btw.)

You can then convert that JSON to TeX-definitions like this:

json2tex -i values.json -o values.tex

... which generates the following values.tex file:

\newcommand{\FirstId}{5f1570db9d5aa0b6df3823f8}
\newcommand{\FirstIndex}{0}
\newcommand{\FirstGuid}{0fdfb3c5-1f0a-4c2a-8fed-75861742b588}
\newcommand{\FirstIsactive}{True}
\newcommand{\FirstBalance}{\$1,652.14}
\newcommand{\FirstPicture}{http://placehold.it/32x32}
\newcommand{\FirstAge}{22}
\newcommand{\FirstEyecolor}{blue}
\newcommand{\FirstNameFirst}{Harrington}
\newcommand{\FirstNameLast}{Emerson}
\newcommand{\FirstCompany}{ISOSURE}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

json2tex-1.1.0.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

json2tex-1.1.0-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page