While Org mode and Emacs are a great combination with a great ecosystem that can be extended in so many ways, there are times when it needs to interact with other systems.
The goal of org2json is to build on top of the work done by orgize, a parsing library (with various examples), and provide an executable for generating json from any org file.
Using Docker
The following command will map the current folder inside the docker container, process README.org
and then save the json output as the file README.json
. Also, it’s going to delete the container when finished.
docker run --rm -v $(pwd):/docs heyste/org2json /app/org2json /docs/README.org > README.json
With other tools like jq it’s possible to explore the json structure of a document.
docker run --rm -v $(pwd):/docs heyste/org2json /app/org2json /docs/README.org | jq .children[0]
{
"type": "section",
"children": [
{
"type": "keyword",
"key": "title",
"value": "Org2JSON",
"post_blank": 0
},
{
"type": "keyword",
"key": "author",
"value": "Stephen Heywood",
"post_blank": 2
}
]
}