Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15055
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Presenting recursive dict (json_diff) |
| Date | 2011-10-27 15:49 -0400 |
| References | <cb9e6eb1-b5a7-4df6-a212-4d953d3f85e5@a17g2000yqj.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2265.1319745006.27778.python-list@python.org> (permalink) |
On 10/27/2011 4:50 AM, mcepl wrote:
> Hi,
>
> I have here a simple script (https://gitorious.org/json_diff/mainline)
> which makes a diff between two JSON files. So for JSON objects
>
> {
> "a": 1,
> "b": 2,
> "son": {
> "name": "Janošek"
> }
> }
>
> and
>
> {
> "a": 2,
> "c": 3,
> "daughter": {
> "name": "Maruška"
> }
> }
>
> it generates
>
> {
> "append": {
> "c": 3,
> "daughter": {
> "name": "Maruška"
> }
> },
> "remove": {
> "b": 2,
> "son": {
> "name": "Janošek"
> }
> },
> "update": {
> "a": 2
> }
> }
>
> (obvious problems with name conflicts between internal keys and the
> investigated keys will be somehow addressed later; any simple Pythonic
> suggestions how?)
Use '_append', etc, much like namedtuple does, for the same reason.
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Presenting recursive dict (json_diff) mcepl <mcepl@redhat.com> - 2011-10-27 01:50 -0700
Re: Presenting recursive dict (json_diff) mcepl <mcepl@redhat.com> - 2011-10-27 02:24 -0700
Re: Presenting recursive dict (json_diff) Terry Reedy <tjreedy@udel.edu> - 2011-10-27 15:49 -0400
Re: Presenting recursive dict (json_diff) Matej Cepl <mcepl@redhat.com> - 2011-10-27 22:58 +0200
Re: Presenting recursive dict (json_diff) Terry Reedy <tjreedy@udel.edu> - 2011-10-28 00:18 -0400
csiph-web