JSON Provider¶
Wraps json library to read and write json.
Hooks¶
Type | Description | Return |
---|---|---|
json | Hook for reading and writing json. Hook reads from path if no data field is provided, otherwise it writes the data to path . |
Union[dict, str] |
json_decode | Hook for decoding a JSON string to a dict. | Union[dict, list] |
json_encode | Hook for converting a dict to a JSON encoded string. | str |
Examples¶
Read json¶
Read a json file into a key
compact->: json path/to/file.json
expanded:
->: json
path: path/to/file.json
Write json¶
Read a json file into a key
stuff:
and: things
compact->: json path/to/file.json "{{stuff}}"
expanded:
->: json
path: path/to/file.json
contents: "{{ stuff }}"