The goal of ggspec is to convert a ggplot2 object into a JSON-serializable list.
You can install the development version from GitHub with:
This is a basic example which shows you how to solve a common problem:
library(ggspec)
## basic example code