Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'duplicate': 0.07; 'json': 0.07; 'subject:file': 0.07; '">>>': 0.22; 'issue.': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; '---': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; '0);': 0.29; 'am,': 0.29; 'medium;': 0.30; 'that.': 0.31; 'probably': 0.32; 'skip:- 30': 0.32; 'rgb(0,': 0.33; 'received:66': 0.35; 'but': 0.35; "didn't": 0.36; 'thanks': 0.36; 'url:org': 0.36; 'skip:- 20': 0.37; 'auto;': 0.38; 'files': 0.38; 'how': 0.40; 'header:Message- Id:1': 0.63; 'real': 0.63; 'more': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'smith': 0.68; 'friendly': 0.72; 'email addr:panix.com': 0.84; 'silently': 0.84; '2013,': 0.91; 'choice.': 0.93; 'lot,': 0.93 Subject: Re: detect key conflict in a JSON file Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/alternative; boundary="Apple-Mail=_36D29EA2-A55D-4F6F-83F5-8FCD3BE2D8B9" From: Roy Smith In-Reply-To: Date: Wed, 29 May 2013 11:20:59 -0400 References: To: Jabba Laci X-Mailer: Apple Mail (2.1283) Cc: Python mailing list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 111 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369840867 news.xs4all.nl 15964 [2001:888:2000:d::a6]:38894 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46391 --Apple-Mail=_36D29EA2-A55D-4F6F-83F5-8FCD3BE2D8B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 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. >>=20 >>> Currently the value of the second key silently overwrites the value = of >>> the first. >=20 > 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 --Apple-Mail=_36D29EA2-A55D-4F6F-83F5-8FCD3BE2D8B9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1
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

=


= --Apple-Mail=_36D29EA2-A55D-4F6F-83F5-8FCD3BE2D8B9--