You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use meld a lot to compare JSON files, and its always an extra step for me to format that on some external tool, before pasting it into meld.
Any chance of adding some basic formatting options?
The text was updated successfully, but these errors were encountered:
Multiple people ran into this issue.
What I did to resolve it is to make a temp copy of each file which i "prettified" first, and then run meld.
Just place this in "/usr/local/bin/meldjson" and make it executable ($ chmod u+x /usr/local/bin/meldjson).
Note sure how safe this is, but it does the job!
Of course you could also create this script as a bash script...
#!/bin/bash
#Pretty meld: prettify JSON files and then execute meld.
script="
import json
import os
def clean(filename):
filename_out = '/tmp/' + os.path.basename(filename)
with open(filename) as f:
data = json.load(f)
with open(filename_out, 'w') as f:
json.dump(data, f, indent=4, sort_keys=True)
return filename_out
filename_tmp_1 = clean('$1')
filename_tmp_2 = clean('$2')
os.system('/usr/bin/meld ' + filename_tmp_1 + ' ' + filename_tmp_2)
os.system('rm ' + filename_tmp_1 + ' ' + filename_tmp_2)
"
python -c "$script"
I use meld a lot to compare JSON files, and its always an extra step for me to format that on some external tool, before pasting it into meld.
Any chance of adding some basic formatting options?
The text was updated successfully, but these errors were encountered: