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


Groups > comp.lang.python > #53386

Re: How do I process this using Python?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <papillion@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'string.': 0.05; 'subject:Python': 0.06; 'json': 0.07; 'string': 0.09; 'indicates': 0.09; 'prefix': 0.09; 'prefixes': 0.09; 'subject:process': 0.09; 'subject:using': 0.09; 'wrapped': 0.09; 'subject:How': 0.10; 'parser.': 0.16; 'remembered': 0.16; 'string:': 0.16; 'unicode?': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'parse': 0.24; 'processor': 0.24; 'unicode': 0.24; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'returned': 0.30; "i'm": 0.30; 'sep': 0.31; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'is.': 0.60; 'needing': 0.65; 'subject:this': 0.83; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=LJXHchTc39OJFL7G2qJEkk5j7ZFOZ2/O+37y4mfVoJE=; b=N/GY1yy6NIVaNsA+Vqd6MPkoS/yCPZztx+jTdNf1TbxZZhVAaRwTjP/cZhyz9JQYl5 Q203YVpLOqut5/qMXmW2JTjL1hDCjU8ckTomdtVUJLk7nUGIESzq1zFCDmFKfgNpvlT8 sn0fuJEIQmLu0UvR3903sFI+UoVNpOWjxyXqUNejDfo+UOLO321tFr3PvF+ezt3k7WoY Q1vD+wCaB8etKl6C3PO0/zqM5gS1Gua7XsJhhWOq6Jat8bhlPzO9wZ86+qW/NIuEbuKw 0Lqu1k2/qQfJ/Tn1tg6shRXGDPj0oa98SBwwofjh0m4y2QKvAMx4o923lkDqlC1oI27O sarQ==
X-Received by 10.182.250.232 with SMTP id zf8mr12017070obc.75.1377994781608; Sat, 31 Aug 2013 17:19:41 -0700 (PDT)
Date Sat, 31 Aug 2013 19:19:40 -0500
From Anthony Papillion <papillion@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8
MIME-Version 1.0
To python-list@python.org
Subject Re: How do I process this using Python?
References <52227FC4.1060208@gmail.com> <CAPTjJmoHeDrUwpuiwx9+Ejz7oE7dOyYibjoTXWu4ycr7fZ2exg@mail.gmail.com>
In-Reply-To <CAPTjJmoHeDrUwpuiwx9+Ejz7oE7dOyYibjoTXWu4ycr7fZ2exg@mail.gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
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.431.1377995161.19984.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377995161 news.xs4all.nl 15865 [2001:888:2000:d::a6]:36534
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53386

Show key headers only | View raw


On 08/31/2013 06:48 PM, Chris Angelico wrote:
> On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion <papillion@gmail.com> wrote:
>> I'm writing a processor for Bitmessage messages and I am needing to
>> parse the following returned JSON string:
>>
>> {u'inboxMessages':
> 
> Does the JSON string really have those u prefixes and apostrophes?
> That's not valid JSON. You may be able to use ast.literal_eval() on it
> - I was able to with the example data - but not a JSON parser. Can you
> sort out your transmission end?
> 
> ChrisA

I think I remembered what the 'u' prefix is. It indicates that the data
following is a unicode string. So could that be valid JSON data wrapped
up in unicode?

Anthony

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


Thread

Re: How do I process this using Python? Anthony Papillion <papillion@gmail.com> - 2013-08-31 19:19 -0500

csiph-web