For example if you have the following JSON object(remove the semicolon for python):
values = {
a: 1,
b: {
c: 2,
d: { e: 3 }
},
f: 4,
g: 5
};
If you try to print values in JS, it will work fine. But in Python it will return an error NameError: name 'a' is not defined which means these variables aren't defined and needs to be set as strings.
Lets say I need to load it into python without manually converting these undefined variables to string. I tried json.loads but it didn't work. Any other built-in functions to do this work?
It seems in JS it automatically treats them as strings if they are not defined or just ignores the fact that they are defined or not?
Any explanation?