Not actually an implementation of the "tool that goes backwards", but I got a smarter YAML library that allowed me to handle multi-line text blobs intelligently. I can now do:
json2yaml view.json > v.yml
- edit v.yml in my favorite power editor including full script blocks
yaml2json v.yml > view.json
My editor doesn't recognize the scripts blobs as Python blocks, but ... I can do sane search-replace or other editing across all scripts in a view from one place and see what is happening w/o going crazy!
This has some promise...
The tricky bit was telling the YAML library which text blocks to force to the escaped multiline format:
import ruamel.yaml as yaml
def str_presenter(dumper, data):
if '\n' in data or '\t' in data: # check for complex or multiline strings
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
yaml.add_representer(str, str_presenter)