Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46391

Re: detect key conflict in a JSON file

Subject Re: detect key conflict in a JSON file
From Roy Smith <roy@panix.com>
Date 2013-05-29 11:20 -0400
References <mailman.2347.1369826248.3114.python-list@python.org> <roy-5C9415.09253929052013@news.panix.com> <CAOuJsMkzEZGEK0gVDMYNk3y3PDgn7+nYxwur_U6=_kaUMKSGUw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2363.1369840867.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On May 29, 2013, at 9:41 AM, Jabba Laci wrote:

>> The real answer here is that JSON is probably not the best choice for
>> large files that get hand-edited.  For data that you intend to hand-edit
>> a lot, YAML might be a better choice.
>> 
>>> Currently the value of the second key silently overwrites the value of
>>> the first.
> 
> Thanks but how would it be different with YAML? Can YAML check duplicate keys?

Oh, I didn't mean to imply that.  I was just pointing out that in general, YAML is more friendly for hand-editing than JSON.  They both have the same GIGO issue.

> How to process (read) YAML files in Python?

Take a look at http://pyyaml.org/


---
Roy Smith
roy@panix.com



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

detect key conflict in a JSON file Jabba Laci <jabba.laci@gmail.com> - 2013-05-29 13:16 +0200
  Re: detect key conflict in a JSON file Roy Smith <roy@panix.com> - 2013-05-29 09:25 -0400
    Re: detect key conflict in a JSON file Jabba Laci <jabba.laci@gmail.com> - 2013-05-29 15:41 +0200
      Re: detect key conflict in a JSON file rusi <rustompmody@gmail.com> - 2013-05-29 07:36 -0700
    Re: detect key conflict in a JSON file Ervin Hegedüs <airween@gmail.com> - 2013-05-29 16:04 +0200
    Re: detect key conflict in a JSON file Roy Smith <roy@panix.com> - 2013-05-29 11:20 -0400
      Re: detect key conflict in a JSON file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-30 03:10 +0000

csiph-web