Object of type 'map' is not JSON serializable
gunhanoral opened this issue · 0 comments
gunhanoral commented
Hello,
It seems there's a problem with map function on json objects.
python -V
Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
>>> graphcommons.status()
{'msg': 'Working'}
>>> graph = graphcommons.new_graph(
... name="Hello from python",
... description="Python Wrapper Test",
... signals=[
... Signal(
... action="node_create",
... name="Ahmet",
... type="Person",
... description="nice guy"
... ),
... Signal(
... action="edge_create",
... from_name="Ahmet",
... from_type="Person",
... to_name="Burak",
... to_type="Person",
... name="COLLABORATED",
... weight=2
... )
... ]
... )
Traceback (most recent call last):
File "<stdin>", line 18, in <module>
File "D:\Program\Anaconda3\lib\site-packages\graphcommons.py", line 119, in new_graph
response = self.make_request('post', 'graphs', data=kwargs)
File "D:\Program\Anaconda3\lib\site-packages\graphcommons.py", line 92, in make_request
"Content-Type": "application/json"
File "D:\Program\Anaconda3\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Program\Anaconda3\lib\site-packages\requests\sessions.py", line 494, in request
prep = self.prepare_request(req)
File "D:\Program\Anaconda3\lib\site-packages\requests\sessions.py", line 437, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "D:\Program\Anaconda3\lib\site-packages\requests\models.py", line 308, in prepare
self.prepare_body(data, files, json)
File "D:\Program\Anaconda3\lib\site-packages\requests\models.py", line 458, in prepare_body
body = complexjson.dumps(json)
File "D:\Program\Anaconda3\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "D:\Program\Anaconda3\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "D:\Program\Anaconda3\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "D:\Program\Anaconda3\lib\json\encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'map' is not JSON serializable
>>>