Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string.': 0.05; 'attribute': 0.07; 'json': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'file,': 0.19; 'cc:addr:python.org': 0.22; 'parse': 0.24; 'string,': 0.24; 'cc:2**0': 0.24; 'second': 0.26; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'minor': 0.31; 'file': 0.32; 'could': 0.34; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'module.': 0.36; 'first': 0.61; 'reads': 0.68; 'smith': 0.68; 'surprise': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=671FVpnW3YRsec9NfTyXs/ZFM0PBXHeBxf8BApOEF8Q=; b=o8ya2zLDpgSXZMIMsgFtR8PwEZ05JF5oYgM7bH4Mhqn+eyLMy9lM/HwEKwyqFMBG96 A7decjVFbsLSe78Rz9h60bAGrCQ9dHBpL/OrTrUoKgQQ2NSIZlP9L8bjf1CPXKAXL6nT LnnieP8UJul0sLxDTQmR2kp2RC7EG9T9CzPviB8SzCE9JDdevZIgwlXoj9StgcHsmtdl jS3Skqc27v8toaP45P+yoNHPES88HQqddVQ/6p7FpJJzgTMx6tdk9gqGxqECsphgxFju FydOREYNfAiUvweOj/S6gFbYQ+qTNClPgUfdaFXNdtEdOip5QkeD8TshLnJ6F8ZxN1Cv sSzQ== MIME-Version: 1.0 X-Received: by 10.221.27.8 with SMTP id ro8mr12771821vcb.30.1401120030421; Mon, 26 May 2014 09:00:30 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 May 2014 02:00:30 +1000 Subject: Re: Verify JSON Data From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401120038 news.xs4all.nl 2871 [2001:888:2000:d::a6]:38491 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72075 On Tue, May 27, 2014 at 1:19 AM, Roy Smith wrote: > Python comes with a built-in json module. Just use json.load() or > json.loads() to parse your JSON data. The first call reads from a > string, the second on from a file, but in all other ways, they're > identical. Minor nit-pick: they're the other way around - load() reads from a file and loads() reads from a string. I wouldn't bother commenting, except that load() could plausibly mean "load from string", and "'str' object has no attribute 'read'" might be a bit of a surprise else :) ChrisA