The list is plain R data - no classes - ready for jsonlite::toJSON() or any
other serialiser. Node types are tagged with their schema name, so
declarations and references stay distinguishable.
Usage
ast_to_json(x, data = c("omit", "inline"))Examples
n <- ast_expression("*", ast_symbol("a"), ast_symbol("b"))
str(ast_to_json(n), max.level = 2)
#> List of 5
#> $ node : chr "expression"
#> $ op : chr "*"
#> $ lhs :List of 2
#> ..$ node: chr "symbol"
#> ..$ name: chr "a"
#> $ rhs :List of 2
#> ..$ node: chr "symbol"
#> ..$ name: chr "b"
#> $ brackets: NULL
