You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature request to make ujson slightly more compatible with Python's json module.
The current version of ujson expects that indent is always specified as an int, otherwise it will raise a TypeError.
However, Python's json module allows the user to specify indent as either an int, None, or a string. In Python, you can specify a string indent as something with non-space characters, but because of the way ujson is implemented, it would be harder to support that without a major refactor. As a compromise, it would be nice if ujson could accept indent as a string, verify that it only contains spaces, and then convert the number of spaces to an int for it's own internal usage.
I think it's worth going for full compatibility even though that requires a significant refactor. I wanted to look into this a while ago, but it got blocked by the buffer overflow issues (cf. #504) since it requires proper memory management.
The refactor wasn't as difficult as I thought it was, so I added full indent support in #518 but I'm not sure if there are memory management issues. It would be good if someone could vet the code.
This is a feature request to make ujson slightly more compatible with Python's json module.
The current version of ujson expects that
indent
is always specified as an int, otherwise it will raise a TypeError.However, Python's json module allows the user to specify indent as either an int, None, or a string. In Python, you can specify a string indent as something with non-space characters, but because of the way ujson is implemented, it would be harder to support that without a major refactor. As a compromise, it would be nice if ujson could accept indent as a string, verify that it only contains spaces, and then convert the number of spaces to an int for it's own internal usage.
With Python's json
Prints:
But in ujson
prints
I have a PR that will resolve this issue.
The text was updated successfully, but these errors were encountered: