benoitc/couchdbkit

Document to_json method not to JSON specification

Closed this issue · 2 comments

When converting a document to json format, through Document.to_json(), the outputted JSON doesn't comply to the specification.

For example, here is some JSON I produced using to_json from a simple object:

{'doc_type': 'Location', 'line': u'Iceland'}

Quotes are meant to be double quotes not single. Also you are not allowed a "u" to indicate a unicode variable, which I am assuming is used for Python only.
There are other things also, such as; "true" not "True", "false" not "False", and "None" is coming out, which should be "null".

I hope I missed something, like an easy way to convert to specification.
Thanks!

to_json is creating a json object (here a full python dict, not a json encoded string so that's expected. json.dumps will dump encode the json object in a json string. Thanks for the ticket anyway.

Thanks benoitc, just what i was thinking.