<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-json-patch.git/doc, branch master</title>
<subtitle>github.com: stefankoegl/python-json-patch.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/'/>
<entry>
<title>Add support for preserving Unicode characters in jsonpatch CLI</title>
<updated>2021-03-03T07:54:40+00:00</updated>
<author>
<name>Genzer Hawker</name>
<email>genzers@gmail.com</email>
</author>
<published>2021-03-03T07:24:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=974d54f393de78ce21bee9897cee8f1ace5813ee'/>
<id>974d54f393de78ce21bee9897cee8f1ace5813ee</id>
<content type='text'>
If the JSON content contains some Unicode characters, the jsonpatch
final output will encode the Unicode character using ASCII (i.e
`\u0394`). This behaviour comes from the module `json.dump()` governed
by a flag `ensure_ascii`[1].

For example:

```json
/* patch.json */
[{
  "op": "add",
  "path": "/SomeUnicodeSamples",
  "value": "𝒞𝘋𝙴𝓕ĢȞỈ𝕵 đ áê 🤩 äÄöÖüÜß"
}]
```

After applying the patch on an empty source file `{}`, this is the
output:

```json
{"SomeUnicodeSamples": "\ud835\udc9e\ud835\ude0b...\u00fc\u00dc\u00df"}
```

This commit adds a flag `-u|--preserve-unicode` in the jsonpatch CLI
to configure the behaviour of `json.dump`'s `ensure_ascii` flag.

Using the `--preserve-unicode` flag, the cli will print the Unicode
characters as-is without any encoding.

[1]: https://docs.python.org/3/library/json.html#basic-usage
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the JSON content contains some Unicode characters, the jsonpatch
final output will encode the Unicode character using ASCII (i.e
`\u0394`). This behaviour comes from the module `json.dump()` governed
by a flag `ensure_ascii`[1].

For example:

```json
/* patch.json */
[{
  "op": "add",
  "path": "/SomeUnicodeSamples",
  "value": "𝒞𝘋𝙴𝓕ĢȞỈ𝕵 đ áê 🤩 äÄöÖüÜß"
}]
```

After applying the patch on an empty source file `{}`, this is the
output:

```json
{"SomeUnicodeSamples": "\ud835\udc9e\ud835\ude0b...\u00fc\u00dc\u00df"}
```

This commit adds a flag `-u|--preserve-unicode` in the jsonpatch CLI
to configure the behaviour of `json.dump`'s `ensure_ascii` flag.

Using the `--preserve-unicode` flag, the cli will print the Unicode
characters as-is without any encoding.

[1]: https://docs.python.org/3/library/json.html#basic-usage
</pre>
</div>
</content>
</entry>
<entry>
<title>Subclassing can override json dumper and loader</title>
<updated>2020-03-06T11:07:24+00:00</updated>
<author>
<name>Christian Lyder Jacobsen</name>
<email>christian@yocuda.com</email>
</author>
<published>2020-03-06T10:41:38+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=0167d345ee9d7ef0f74b947ec3a7ea94def178be'/>
<id>0167d345ee9d7ef0f74b947ec3a7ea94def178be</id>
<content type='text'>
Additionally:

* from_string gets a loads parameter
* to_string gets a dumps_parameter
* documentation added
* added more tests
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Additionally:

* from_string gets a loads parameter
* to_string gets a dumps_parameter
* documentation added
* added more tests
</pre>
</div>
</content>
</entry>
<entry>
<title>Drop support for EOL Python 3.3</title>
<updated>2018-01-16T12:22:33+00:00</updated>
<author>
<name>Hugo</name>
<email>hugovk@users.noreply.github.com</email>
</author>
<published>2018-01-16T12:22:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=71bdeed8b49390ff14fe8f0434fc8a1038d89128'/>
<id>71bdeed8b49390ff14fe8f0434fc8a1038d89128</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update supported versions in docs</title>
<updated>2017-10-21T08:45:00+00:00</updated>
<author>
<name>Stefan Kögl</name>
<email>stefan@skoegl.net</email>
</author>
<published>2017-10-21T08:41:24+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=b6514dd9551d453f2ee8485283d538e00f5015be'/>
<id>b6514dd9551d453f2ee8485283d538e00f5015be</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add empty _static dir to avoid docs warning</title>
<updated>2013-10-12T10:20:52+00:00</updated>
<author>
<name>Stefan Kögl</name>
<email>stefan@skoegl.net</email>
</author>
<published>2013-10-12T10:20:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=3009bacd64077778ed02f73b974ca56c89dd5f4a'/>
<id>3009bacd64077778ed02f73b974ca56c89dd5f4a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add docs for commandline utilities</title>
<updated>2013-10-12T10:20:38+00:00</updated>
<author>
<name>Stefan Kögl</name>
<email>stefan@skoegl.net</email>
</author>
<published>2013-10-12T10:20:38+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=2d2102c5e9aa8f2c915fa66d4eeb1db64a7bc221'/>
<id>2d2102c5e9aa8f2c915fa66d4eeb1db64a7bc221</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add documentation</title>
<updated>2013-04-13T22:11:03+00:00</updated>
<author>
<name>Stefan Kögl</name>
<email>stefan@skoegl.net</email>
</author>
<published>2013-04-13T22:11:03+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-json-patch.git/commit/?id=e231fa02fa4ccbee6636763672b79bf951f7829e'/>
<id>e231fa02fa4ccbee6636763672b79bf951f7829e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
