0

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
        }
    }
});
shurrok
  • 795
  • 2
  • 13
  • 43
  • Check this out and see if it helps you solve your problem: https://stackoverflow.com/questions/36517173/how-to-store-a-javascript-function-in-json – FcoRodr Oct 30 '17 at 13:02
  • This is not the problem, I want just ommit the function and store the rest in the json – shurrok Oct 30 '17 at 13:03

0 Answers0