parsing JSON which contains "objects"
Question: I'm getting data from an application that returns what seems to be an JSON,
but with some "objects". For instance:

    
    
    {"rgEvtData":[new VisData(0,0,1,0,1,0,0,0,0,-1),new VisData(0,1,1,1,1,0,0,0,0,-1),new VisData(0,2,1,2,1,0,0,0,0,-1),new VisData(0,3,2,0,1,0,0,0,0,-1),new VisData(0,4,2,1,1,0,0,0,0,-1),new VisData(0,5,2,2,1,0,0,0,0,-1),new VisData(0,6,2,3,1,0,0,0,0,-1),new VisData(0,7,3,0,1,0,0,0,0,-1),new VisData(0,8,3,1,1,0,0,0,0,-1)]}
    

any idea if I can parse it on python without dirty workarounds (ie, replace()
or regexp)?


Answer: No, you can't.  
Even if python could parse it, what would it do with the `VisData`s?

I think your only option (except the stick approach mentioned), to translate
this string into valid JSON somehow. For example, replacing `new VisData(...)`
with `[...]`, or `{"class": "VisData", "args": [...]}` if you have multiple
classnames. But you said you don't want that.

**Update**  
I have an example, I think it is what you need.  
It handles custom classes in the format you provided. It would also handle
multiple classes and any number/type of constructor arguments.

    
    
    import re
    import json
    
    # our python VisData class
    class VisData(object):
        def __init__(self, *args):
            self.args = args
    
    # object hook to convert our {"class":"VisData","args":[...]} dict to VisData insances
    def object_hook(obj):
        # if we recognize our object describer dict
        if len(obj) == 2 and "class" in obj and "args" in obj:
            # instantiate our classes by name
            clazz = globals()[obj["class"]]
            args = obj["args"]
            return clazz(*args)
        return obj
    
    # input
    input_string = '{"rgEvtData":[new VisData(0,0,1,0,1,0,0,0,0,-1),new VisData(0,1,1,1,1,0,0,0,0,-1)]}'
    
    # make it json
    json_string = re.sub(r'new (\w+)\(([^\)]*)\)', r'{"class":"\1","args":[\2]}', input_string)
    
    # parse it with our object hook
    data = json.loads(json_string, object_hook=object_hook)
    
    # result
    print(data)                         # -> {u'rgEvtData': [<__main__.VisData object at 0x1065d8210>, <__main__.VisData object at 0x1065d8250>]}
    print(data["rgEvtData"][0])         # -> <__main__.VisData object at 0x1065d8210>
    print(data["rgEvtData"][0].args)    # -> (0, 0, 1, 0, 1, 0, 0, 0, 0, -1)
    

