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


Groups > comp.lang.python > #46378

Re: detect key conflict in a JSON file

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jabba.laci@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'duplicate': 0.07; 'json': 0.07; 'subject:file': 0.07; 'received:209.85.219': 0.09; 'cc:addr :python-list': 0.11; 'started?': 0.16; 'subject:key': 0.16; 'yaml': 0.16; 'thanks,': 0.17; 'first.': 0.19; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'probably': 0.32; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'received:209': 0.37; 'files': 0.38; 'how': 0.40; 'read': 0.60; 'real': 0.63; 'different': 0.65; 'here': 0.66; 'hints': 0.68; 'silently': 0.84; 'choice.': 0.93; 'lot,': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=76OeIOUdaBFBU/SNHC4aZqHCSQpNnA66Zb0sXEWupPY=; b=JciUJfk4EKNCQVh+Bu1FFeLej+iM+7mNpw8M5xBaHc0SnI1B9KVGyA8RWGv2evIrZ8 Kzr5NxeJZL8S1uHctF1Nw51EBo5uF0uAzYmfbWt2BznIyt3RwrBTH2puuBOVg+D255Pb PidBuoNYFjB9My/RPPbEjh+19revbmdTv2yI+NXGwC0I7DKapOXJpGV6nvg0SFofYEUx Z9m5+4glSrCw0NYEDHyzgj7t5Sgj9cFkmR406iETAOOnP1T2S8/cJnMM9RAQ77ZUGLqk dNHj/MBgdGj+GQUMEIFvIxNz97WWAu8mnvGMDGAnszJfDdntSDhZtfmgu7ECnISXK/2w e0wg==
X-Received by 10.60.79.68 with SMTP id h4mr1694715oex.39.1369834931987; Wed, 29 May 2013 06:42:11 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <roy-5C9415.09253929052013@news.panix.com>
References <mailman.2347.1369826248.3114.python-list@python.org> <roy-5C9415.09253929052013@news.panix.com>
From Jabba Laci <jabba.laci@gmail.com>
Date Wed, 29 May 2013 15:41:50 +0200
Subject Re: detect key conflict in a JSON file
To Roy Smith <roy@panix.com>
Content-Type text/plain; charset=ISO-8859-1
Cc Python mailing list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2357.1369834941.3114.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369834941 news.xs4all.nl 15921 [2001:888:2000:d::a6]:44001
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46378

Show key headers only | View raw


> 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?

How to process (read) YAML files in Python? Can you give me some hints
how to get started? All I need is read it in and create a dictionary
of it.

Thanks,

Laszlo

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