json

要从单个Python脚本生成Bokeh应用程序的序列化JSON表示,请将脚本名称传递给 bokeh json 在命令行上:

bokeh json app_script.py

生成的JSON将以名称保存在当前工作目录中 app_script.json .

也可以从目录创建应用程序。目录应包含 main.py (以及所需的任何其他助手模块)以及任何附加资产(例如,主题文件)。将目录名传递给 bokeh json 要生成JSON:

bokeh json app_dir

默认情况下,生成的JSON作为一行输出,没有缩进。要在多行上生成“pretty printed”JSON,可以使用 --indent 论点:

bokeh json app_script.py --indent=2
class JSON(parser: argparse.ArgumentParser)[源代码]

子命令将应用程序输出为序列化的JSON

file_contents(args: argparse.Namespace, doc: bokeh.document.document.Document)str[源代码]
extension: str = 'json'

由此扩展名生成的文件 FileOutputSubcommand

name: str = 'json'

此子命令的名称