Convert obejct string repr to actual object

  • Thread starter =?ISO-8859-1?Q?Tor_Erik_S=F8nvisen?=
  • Start date
?

=?ISO-8859-1?Q?Tor_Erik_S=F8nvisen?=

Hi,

I've tried locating some code that can recreate an object from it's
string representation...
The object in question is really a dictionary containing other
dictionaries, lists, unicode strings, floats, ints, None, and
booleans.

I don't want to use eval, since I can't trust the source sending the
object.... I'm sure someone must have had the same need and created
code for it... Maybe Pypy has what I need??? Haven't looked though...

Regards,
Tor Erik

PS: The string repr is created by a server outside of my control...
 
D

Diez B. Roggisch

Tor said:
Hi,

I've tried locating some code that can recreate an object from it's
string representation...
The object in question is really a dictionary containing other
dictionaries, lists, unicode strings, floats, ints, None, and
booleans.

I don't want to use eval, since I can't trust the source sending the
object.... I'm sure someone must have had the same need and created
code for it... Maybe Pypy has what I need??? Haven't looked though...


Try using simplejson.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top