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


Groups > comp.lang.python > #71543 > unrolled thread

Re: problems decoding json objects

Started bySkip Montanaro <skip@pobox.com>
First post2014-05-14 05:39 -0500
Last post2014-05-14 07:43 -0400
Articles 2 — 2 participants

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.


Contents

  Re: problems decoding json objects Skip Montanaro <skip@pobox.com> - 2014-05-14 05:39 -0500
    Re: problems decoding json objects Roy Smith <roy@panix.com> - 2014-05-14 07:43 -0400

#71543 — Re: problems decoding json objects

FromSkip Montanaro <skip@pobox.com>
Date2014-05-14 05:39 -0500
SubjectRe: problems decoding json objects
Message-ID<mailman.9998.1400063958.18130.python-list@python.org>
On Wed, May 14, 2014 at 3:36 AM, Tamer Higazi <th982a@googlemail.com> wrote:
> myjs =
> '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"},{"KontaktTel":["01234","11223344"],{"ZahlungsArt":"0"},{"ZugangsDaten":["tamer.higazi@nomail.com","mypass"]}'

Following up on Ben's comment, what did you expect? With my Python hat
on, I'd say you've got a string representing a tuple of four
dictionaries, though my human brain can see past the missing '}' which
is supposed to close the second dict. If you add that, it's still not
valid JSON (I guess JSON doesn't have tuples). This stuff isn't meant
to be typed by humans. Instead computers are supposed to barf it out
and munch on it. As Ben indicated, putting it in a string is
pointless. Might as well just define the dictionaries yourself.

not-gonna-mention-eval-ly, y'rs

Skip

[toc] | [next] | [standalone]


#71547

FromRoy Smith <roy@panix.com>
Date2014-05-14 07:43 -0400
Message-ID<roy-07358D.07433314052014@news.panix.com>
In reply to#71543
In article <mailman.9998.1400063958.18130.python-list@python.org>,
 Skip Montanaro <skip@pobox.com> wrote:

> I guess JSON doesn't have tuples

JSON has sequences, which both Python lists and tuples serialize as 
(losing the distinction between them).  In the other direction, JSON 
sequences typically unpack as lists, but I think that's just convention.  
There might be json packages which unpack them as tuples.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web