Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'output': 0.05; 'subject:Python': 0.06; '(python': 0.07; 'column': 0.07; 'json': 0.07; 'data:': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:extra': 0.09; 'thus,': 0.09; 'python': 0.11; '(char': 0.16; '307': 0.16; 'container.': 0.16; 'dump': 0.16; 'folder.': 0.16; 'invalid.': 0.16; 'one)': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; '(not': 0.18; 'input': 0.22; 'example': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; 'header:X-Complaints-To:1': 0.27; 'went': 0.31; 'code': 0.31; 'apparently': 0.31; 'writes:': 0.31; 'file': 0.32; 'run': 0.32; 'could': 0.34; 'problem': 0.35; 'there': 0.35; 'subject:data': 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'tell': 0.60; 'back': 0.62; 'received:217': 0.63; 'email addr:gmail.com': 0.63; 'such': 0.63; 'containing': 0.69 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Python JSON processing - extra data error Date: Tue, 31 Mar 2015 08:05:17 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0855d.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:r2NkF2ObJbj2XUiWNMOXAzy6lfs= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427781935 news.xs4all.nl 2858 [2001:888:2000:d::a6]:39226 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88362 karthik.sharma@gmail.com writes: > I have the following python program to read a set of JSON files do some processing on it and dump them back to the same folder. However When I run the below program and then try to see the output of the JSON file using > > `cat file.json | python -m json.tool` > > I get the following error > > `extra data: line 1 column 307 - line 1 column 852 (char 306 - 851)` You might have got a traceback which would tell you where precisely the problem was detected. Looking the the code there (Python is "Open Source"; thus, you can look at code) will tell you what apparently went wrong. "extra data" suggests to me that your JSON input may be invalid. "1 2", for example could cause such a problem, because it contains two integers (not a single one) without a containing container.