Skip to content

set object is not JSON serializable with iterable_mode=IM_ANY_ITERABLE #168

Description

@gdub
>>> rapidjson.dumps({1}, iterable_mode=rapidjson.IM_ANY_ITERABLE)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: {1} is not JSON serializable
>>> rapidjson.__version__
'1.8'

Given that documentation states "any iterable will be dumped as a JSON array," I would expect a set object to serialize to an array.

Note, it does appear that creating an iterator object from the set will successfully serialize:

>>> rapidjson.dumps(iter({1}), iterable_mode=rapidjson.IM_ANY_ITERABLE)
'[1]'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions