Open ghost opened 8 years ago
this would be useful as a command line tool as well, something like:
__main__.py
#!/usr/bin/env python """ Cli jsonmerge tool. """ import argparse import json import jsonmerge ARGP = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter, ) ARGP.add_argument('files', nargs='+', help='Json Input Files') ARGP.add_argument('--merge-strategy', '-X', help='Root node merge strategy') def main(argp=None): if argp is None: argp = ARGP.parse_args() schema = dict() if argp.schema: with open(argp.schema) as file_handle: schema = json.load(file_handle) result = {} for file in argp.files: with open(file) as file_handle: result = jsonmerge.merge(result, json.load(file_handle), schema) print(json.dumps(result, indent=4)) if __name__ == '__main__': main()
With
That would be great.
Hi. If you can develop this feature and add tests and documentation, I would be happy to accept a pull request.
this would be useful as a command line tool as well, something like:
__main__.py
With
the ability to apply a merge strategy to the root nodeThat would be great.