Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/jsonpatch
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ parser.add_argument('-i', '--in-place', action='store_true',
help='Modify ORIGINAL in-place instead of to stdout')
parser.add_argument('-v', '--version', action='version',
version='%(prog)s ' + jsonpatch.__version__)

parser.add_argument('-u', '--preserve-unicode', action='store_true',
help='Output Unicode character as-is without using Code Point')

def main():
try:
Expand Down Expand Up @@ -72,8 +73,8 @@ def patch_files():

# By this point we have some sort of file object we can write the
# modified JSON to.

json.dump(result, fp, indent=args.indent)
json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode))
fp.write('\n')

if args.in_place:
Expand Down
10 changes: 6 additions & 4 deletions doc/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ The program ``jsonpatch`` is used to apply JSON patches on JSON files. ::
PATCH Patch file

optional arguments:
-h, --help show this help message and exit
--indent INDENT Indent output by n spaces
-v, --version show program's version number and exit

-h, --help show this help message and exit
--indent INDENT Indent output by n spaces
-b, --backup Back up ORIGINAL if modifying in-place
-i, --in-place Modify ORIGINAL in-place instead of to stdout
-v, --version show program's version number and exit
-u, --preserve-unicode Output Unicode character as-is without using Code Point

Example
^^^^^^^
Expand Down