Syntax for documenting JSON structure

前端 未结 7 1857
别那么骄傲
别那么骄傲 2021-01-31 01:14

So I\'m trying to document the format of the json returned by an api I am writing against and I\'d like to know if there is any popular format for the documentation of json stru

7条回答
  •  耶瑟儿~
    2021-01-31 01:51

    A simple but effective way is to create a JSON schema with a JSON schema generator and then use JSON Schema for Humans, a Python utility to create html interactive documentation:

    pip install json-schema-for-humans
    generate-schema-doc [OPTIONS] SCHEMA_FILE [RESULT_FILE]
    

    Useful references:

    1. pypi json-schema-for-humans page
    2. json-schema-for-humans documentation that includes some visual examples of the output

    Keep in mind the JSON Schema is still in Draft state as of now, with the aim of becoming a IETF standard in the future.

提交回复
热议问题