Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53389 > unrolled thread
| Started by | Anthony Papillion <papillion@gmail.com> |
|---|---|
| First post | 2013-08-31 19:45 -0500 |
| Last post | 2013-08-31 19:45 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How do I process this using Python? Anthony Papillion <papillion@gmail.com> - 2013-08-31 19:45 -0500
| From | Anthony Papillion <papillion@gmail.com> |
|---|---|
| Date | 2013-08-31 19:45 -0500 |
| Subject | Re: How do I process this using Python? |
| Message-ID | <mailman.434.1377996347.19984.python-list@python.org> |
On 08/31/2013 07:32 PM, Cameron Simpson wrote:
> On 31Aug2013 19:19, 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?
> |
> | 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?
>
> How sure are you that it is JSON? It looks to me like a message
> that might once have been JSON, but has already been passed through
> json.loads() for you.
>
> What does type(the_json) say? What does repr(the_json) say?
> Print both.
>
> I would guess it has already been parsed.
>
> Cheers,
And you would be right! It's actually a dictionary!
Anthony
Back to top | Article view | comp.lang.python
csiph-web