pombreda / wave-robot-python-client

Automatically exported from code.google.com/p/wave-robot-python-client
Apache License 2.0
0 stars 0 forks source link

waveapi.util.Serialize produces non-JSON string literals #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> import waveapi.document
>>> import waveapi.util
>>>
waveapi.util.Serialize([waveapi.document.Image('http://example.com/foo.jpg', 
width=100,
height=100)])

What is the expected output? What do you see instead?

A JSON string (i.e. one where strings are delimited using double quotes). 
Instead I see:

{'javaClass': 'java.util.ArrayList', 'list': [{'type': 'IMAGE',
'properties': {'javaClass': 'java.util.HashMap', 'map': {'url':
'http://example.com/foo.jpg', 'width': 100, 'height': 100}}, 'java_class':
'com.google.wave.api.Image'}]}

What version of the product are you using? On what operating system?

SVN head on Ubuntu.

Original issue reported on code.google.com by sa3ruby@gmail.com on 2 Jun 2009 at 10:13

GoogleCodeExporter commented 9 years ago
Serialize actually returns a Python dictionary, which is what you are seeing in 
the
interpreter. "Serialize" here means serializing to the abstract data structure 
of the
wire protocol; to get an actual JSON string, you need to call simplejson.dumps 
on the
result. That, by the way, is what SerializeContext does in robot_abstract.py. 
You can
look at robot_abstract_test.py to verify that the string output of that does use
double quotes.

Original comment by artdent on 12 Jun 2009 at 6:49