开发者

Why does Sphinx generate json?

I notice that Sphinx has the ab开发者_运维百科ility to generate documentation in JSON. What are these files used for?


As the docs say, it's

for use of a web application (or custom postprocessing tool) that doesn’t use the standard HTML templates.

json's a good simple way for language-agnostic data interchange, so, why not?-)


I assume you're talking about the SerializingHTMLBuilder, in which case I think the answer might be that there isn't necessarily a specific purpose in mind. Rather many things provide conversion routines of various kinds with a "loads/dumps" API convention, and the json module (known as simplejson before it was brought standard library in 2.6) is but one of many such packages.

Presumably some people would prefer to work with data in JSON format for their own purposes. If I were trying to build some sort of dynamic Javascripty documentation system, I could well imagine choosing to use JSON as the way to get documentation from the backend out to the client in a manageable format, if for some reason HTML or XML didn't seem like the better option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜