problems decoding json objects

Ben Finney ben at benfinney.id.au
Wed May 14 06:46:36 EDT 2014


Ben Finney <ben at benfinney.id.au> writes:

> Tamer Higazi <th982a at googlemail.com> writes:
> > How do I solve this problem ?!
>
> Fix the document. Where did it come from?

If you're the one typing raw JSON into your program: Fix that. Don't
type raw JSON.

JSON is an object serialisation format; it's foolish to type it
yourself. You should only be generating it from a known-debugged JSON
library, or reading it as input from some other generator.

If you want to define an object in a Python literal, type Python code.


Skip Montanaro <skip at pobox.com> writes:

> 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.

It didn't even occur to me that the programmer would have typed this in
manually. Good catch, Skip.

-- 
 \     “Why doesn't Python warn that it's not 100% perfect? Are people |
  `\         just supposed to “know” this, magically?” —Mitya Sirenef, |
_o__)                                     comp.lang.python, 2012-12-27 |
Ben Finney




More information about the Python-list mailing list