http://www.sololearn.com/app/python/playground/cccWU44hBrcZ/ why is this code non-Json serializable?? it works on solo learn but is raising the Json error on the proctor site. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python why is this code non-Json serializable?? it works on solo learn but is raising the Json error on the proctor site.

11th Sep 2016, 3:32 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
6 Answers
0
... Your question does not match your code. Nonetheless I shall try to entertain you. Python dictionary string representation happens to be in JSON. You don't need to serialize it. If you are talking about the intended result the function, the test value you gave it doesnt pass the validation you made so I cant see what is wrong with the dictionary it is supposed to return.
11th Sep 2016, 9:39 PM
Gershon Fosu
Gershon Fosu - avatar
0
Gershon I don't get you. I pasted the code on solo learn and maybe that is why the indents may have a problem. It is very stressful editing on solo learn but I once did that and it worked. when I transfered my working solution to the proctor, it was still rejected. I repasted that solution back on solo learn and the indents scattered up again. my issue is this: what should I change to avoid a Json error. for n in d.keys: d[n]= xyz result={} result[n]=d[n] print( result) I want to know if this is where the problem is and if I can change the method I am using to access the dictionary values.
11th Sep 2016, 9:50 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
0
ok could u send it by email gfosu1997@gmail.com
11th Sep 2016, 10:14 PM
Gershon Fosu
Gershon Fosu - avatar
0
ok bro. thanks
11th Sep 2016, 10:14 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
0
you can check your mail now.
11th Sep 2016, 10:26 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar