Skip to content
This repository has been archived by the owner on Mar 8, 2018. It is now read-only.

Add simplejson-compatible parameters #4

Open
alecf opened this issue Dec 18, 2009 · 3 comments
Open

Add simplejson-compatible parameters #4

alecf opened this issue Dec 18, 2009 · 3 comments

Comments

@alecf
Copy link

alecf commented Dec 18, 2009

In particular:

dumps needs at least:

  • indent which is a number of spaces to indent
  • sort_keys - whether to sort dict keys in the output (for predictable serialization)
  • default - which is a function that gets called on anything that's not normally json-encodable, return value is used as the string value

not sure loads() needs anything.

@mikeal
Copy link

mikeal commented Dec 18, 2009

API compatibility with simplejson would be ideal:

http://docs.python.org/library/json.html#json.dump

@alecf
Copy link
Author

alecf commented Dec 21, 2009

A clarification on indent:

indent=None (the default) means "dont' indent, make JSON the minimum size (i.e. no extra spaces)
indent=N, where N is an integer means "use N spaces to indent, with newlines, etc"
indent=0 means "no indenting, but still use newlines" (i.e. consistent with N)

@rtyler
Copy link
Owner

rtyler commented Dec 22, 2009

Support for indent on dump/dumps added with SHA: adeeb98

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants