Best way to encode tuples with json

后端 未结 5 1854
有刺的猬
有刺的猬 2021-02-05 00:23

In python I have a dictionary that maps tuples to a list of tuples. e.g.

{(1,2): [(2,3),(1,7)]}

I want to be able to encode this data use it with j

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 01:07

    You can't use an array as a key in JSON. The best you can do is encode it. Sorry, but there's really no other sane way to do it.

提交回复
热议问题