Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53388
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| 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; 'python.': 0.02; 'string.': 0.05; 'subject:Python': 0.06; 'json': 0.07; 'string': 0.09; 'encoder': 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; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'incorrect': 0.16; 'parser.': 0.16; 'remembered': 0.16; 'repr()': 0.16; 'shortcut': 0.16; 'string:': 0.16; 'unicode.': 0.16; 'unicode?': 0.16; 'wrote:': 0.18; "python's": 0.19; 'written': 0.21; 'seems': 0.21; '>>>': 0.22; 'example': 0.22; '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; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'sep': 0.31; 'text': 0.33; 'could': 0.34; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'is.': 0.60; 'simply': 0.61; '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=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=6Ah5aGLHgRDgMGB5+kX27dptLH2PF6R4QY61rXsdq7I=; b=HY26xZjd4Bb433XaqwHvTBTwhOJx+FTkNlcbKWJe/4xPxnC1E0OgspknAp1m1uRaV1 ux6FaiHXrTlziLiKd8Omh2iesBxgXw83IEZIC0tcoW5u/be6ecykgKAaDS0EdkMa9Vk8 zwtdfSmFsbvLZJwmtX/hozKYeb/g2yptaykEepxwopz+mtQHbbPv8KnTSH0FjydmNUKC 2ozBAvDnYugV5lKMN/YaisIm6mAhv1VVK7QsaW30so/NQ0Ag9Z+gITuUbbHtR54Y9zGu urTIMXKsMs0JQydyPVcz7MHMCbmHSX3KGcA33vPXm40bDx+JAfxa1eF9m6YS5CiGZh1y Jcaw== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.152.3 with SMTP id uu3mr15673756veb.16.1377995524098; Sat, 31 Aug 2013 17:32:04 -0700 (PDT) |
| In-Reply-To | <5222881C.8060205@gmail.com> |
| References | <52227FC4.1060208@gmail.com> <CAPTjJmoHeDrUwpuiwx9+Ejz7oE7dOyYibjoTXWu4ycr7fZ2exg@mail.gmail.com> <5222881C.8060205@gmail.com> |
| Date | Sun, 1 Sep 2013 10:32:04 +1000 |
| Subject | Re: How do I process this using Python? |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.432.1377995530.19984.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377995530 news.xs4all.nl 15900 [2001:888:2000:d::a6]:39416 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53388 |
Show key headers only | View raw
On Sun, Sep 1, 2013 at 10:19 AM, Anthony Papillion <papillion@gmail.com> wrote:
> 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?
No; JSON already supports Unicode. What you may have is an incorrect
JSON encoder that uses Python's repr() to shortcut its work - but it's
wrong JSON.
But bitmessage seems to be written in Python. Can you simply access
the objects it's giving you, rather than going via text strings?
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How do I process this using Python? Chris Angelico <rosuav@gmail.com> - 2013-09-01 10:32 +1000
csiph-web