There are tutorials on using JSON to handle branching dialog:
construct.net/en/tutorials/json-branch-dialogue-example-3013
construct.net/en/tutorials/branching-dialogue-using-json-2395
Develop games in your browser. Powerful, performant & highly capable.