How can I convert a JavaScript variable (not JSON format) into a python variable?
Example JavaScript variable:
{
title: "TITLE",
name: "NAME",
active: false,
info: {
key1: "value1",
dict1: {
sub_key1: "sub_value1",
sub_key2: "sub_value2",
},
dict2: {
sub_key3: "sub_value3",
sub_key4: "sub_value4",
sub_key5: "sub_value5"
},
},
list1: ["element1", "element2", "element2"],
}
This format looks just like the input in this question. Try adapting the pyparsing parser I posted there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With