
import sys
import json

for filepath in sys.argv[1:]:
    with open(filepath) as f:
        try:
            oyster = json.load(f)
        except ValueError:
            sys.stderr.write("In file: {}\n".format(filepath))
            raise
    with open(filepath, 'w') as f:
        json.dump(oyster, f, indent=4, separators=(',', ': '), sort_keys=True)
        f.write('\n') # add a trailing newline.


import sys
import json

for filepath in sys.argv[1:]:
    with open(filepath) as f:
        try:
            oyster = json.load(f)
        except ValueError:
            sys.stderr.write("In file: {}\n".format(filepath))
            raise
    with open(filepath, 'w') as f:
        json.dump(oyster, f, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True)
        f.write('\n') # add a trailing newline.

Make this work for non-ASCII chars as well.
Make this work for non-ASCII chars as well.

  
  import sys
  import json
  
  for filepath in sys.argv[1:]:
      with open(filepath) as f:
          try:
              oyster = json.load(f)
          except ValueError:
              sys.stderr.write("In file: {}\n".format(filepath))
              raise
      with open(filepath, 'w') as f:
-         json.dump(oyster, f, indent=4, separators=(',', ': '), sort_keys=True)
+         json.dump(oyster, f, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True)
          f.write('\n') # add a trailing newline.
  
Make this work for non-ASCII chars as well.
## Code Before:

import sys
import json

for filepath in sys.argv[1:]:
    with open(filepath) as f:
        try:
            oyster = json.load(f)
        except ValueError:
            sys.stderr.write("In file: {}\n".format(filepath))
            raise
    with open(filepath, 'w') as f:
        json.dump(oyster, f, indent=4, separators=(',', ': '), sort_keys=True)
        f.write('\n') # add a trailing newline.

## Instruction:
Make this work for non-ASCII chars as well.
## Code After:

import sys
import json

for filepath in sys.argv[1:]:
    with open(filepath) as f:
        try:
            oyster = json.load(f)
        except ValueError:
            sys.stderr.write("In file: {}\n".format(filepath))
            raise
    with open(filepath, 'w') as f:
        json.dump(oyster, f, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True)
        f.write('\n') # add a trailing newline.
