refactor json api handlers, use a single dict object for all handlers instead of ordered args