What I need to do is parse some data in JavaScript
to JSON
. In my data I have some fields (e.g. functions) that can't be formatted to JSON
. That is why I want to convert it to something like raw data/literal string. As far as I know this should help me iterate over it and add the proper things to a dictionary (or ommit some data like functions) so I can parse it to JSON
easily later. Is there a proper way to do that? Or Am I missing something? Maybe I cannot do that? I'm working in Python
. This is sample JavaScript code:
MyObject.data('container', {
animal: {
type: 'big'
},
name: {
shortname: 'jerry'
},
additionalData: {
text: 'Source: <a href="example.com">' +
'example.com</a>'
},
moreData: {
numebrofLegs: 4,
someFuncion: {
datadata: function () {
return this.name; // some comment
}
}
});