Use fence block to render auto formatted json and use extra capabilities described below Use include plugin to read json from an external file json ```json [{"key1": "value1"}, {"key2": "value2"}] ``` json [{"key1": "value1"}, {"key2": "value2"}] :include-json: simple.json
Use the parameter to highlight an individual value: Pass multiple values to to highlight more than one leaf value Comma-separated paths specified inside will be highlighted. ```json {highlightValue: "root[1].key2"} [{"key1": "value1"}, {"key2": "value2"}] ``` :include-json: book-store.json {highlightValue: ["root.store.book[0].category", "root.store.book[2].category"]}
Highlight Values By Path From File
Use to specify a file with paths to highlight values. :include-json: book-store.json {highlightValueFile: "book-store-paths.json"}
Use the parameter to highlight keys: ```json {highlightKey: "root[1].key2"} [{"key1": ["value11", "value12"]}, {"key2": ["value21", "value22"]}] ```
Highlight Keys By Path From File
Use to specify a file with paths to highlight keys. :include-json: book-store.json {highlightKeyFile: "book-store-paths.json"}
To include only a portion of your document pass Json Path as property: :include-json: book-store.json {include: "$..book[0,1]"}
Use to wrap any JSON and include result into parent object(s) :include-json: book-store.json {encloseInObject: "books.rare", include: "$..book[0,1]"}
Use parameter to specify a snippet title: Use to automatically set title to specified file name title :include-json: book-store.json {include: "$..book[0,1]", title: "Books"} autoTitle: true :include-json: book-store.json {include: "$..book[0,1]", autoTitle: true}
When you specify a title, hover mouse over it to see a clickable anchor. Use to override auto generated identifier. anchorId :include-json: book-store.json {include: "$..book[0,1]", title: "Books", anchorId: "my-books"}
Use to show only first lines of . Optional can be specified to set the initial number of lines to display readMore JSON readMoreVisibleLines :include-json: book-store.json {readMore: true, readMoreVisibleLines: 5}
To hide sub-parts of your use property. JSON collapsedPaths :include-json: book-store.json {collapsedPaths: ['root.store.book']}
To highlight a specific value using , in (similar fashion to regular code snippets, you can highlight a line by text matching or by providing a line index. JSON paths :include-json: book-store.json {highlight: ["category", 2]}
You can turn parts of into links to internal or external pages. JSON :include-json: trader.json { title: "trader", referencesPath: "references/json-references-demo.csv" } trader, example-references/domain#trader transaction, example-references/domain#transaction
Use parameter to attach bullet points with explanation to a json path: } callouts :include-json: book-store.json { collapsedPaths: ['root.store.book'], callouts: { "root.store.bicycle.color": "subject of **availability**", "root.store.bicycle.price": "*price* changes daily" }} }
Use parameter to read callouts from a separate file. Can reduce duplication and allows to generate callouts at runtime. CSV format is also supported calloutsFile :include-json: book-store.json { collapsedPaths: ['root.store.book'], calloutsFile: "schema-notes.json" } { "root.store.bicycle.color": "subject of **availability**", "root.store.bicycle.price": "*price* changes daily" } root.store.bicycle.color, subject of **availability** root.store.bicycle.price, *price* changes daily
Below is an example of using WebTau testing framework to make an HTTP call, extract JSON response and information about asserted fields to highlight. http.get("/weather") { temperature.shouldBe < 100 } http.doc.capture("weather-example") captures multiple test artifacts into separate files: request/response.json, url.txt, paths.json (validated paths). http.doc.capture :include-json: weather-example/response.json { title: "weather response example", highlightValueFile: "weather-example/paths.json" }
All the features above require fully formed JSON. If you need only syntax highlighting use include-file plugin :include-file: incomplete.json { "config": { ... } }