Use just one inputToJSON function.