tags:

views:

36

answers:

1

I'm trying to serialize obj using json (Python). I wish to skip json's unknown type I know I can add my own encoder, but what I'm interested in is to just skip the unknown type. I don't want to use None instead. I have tried

icon=QIcon()        
arr=["blablal",icon]    
str1=simplejson.dumps(arr,skipkeys=True)

I used the skipkeys option to skip the icon object which is unknown type for json but I keep getting TypeError exception. What am I doing wrong?

A: 

Ok so i found the problem

icon isn't a key but a value if icon was used as a key in a dict it would have been ignored

jojo
If this resolves your problem, you should accept your own answer so that the question shows up as solved and so your accept rate is improved.
Conspicuous Compiler
according to forum policy i can do that only in two days
jojo