There are three different issues:
1) You don't create an object with new Main(), but try to access the Sub property directly from the constructor. This doesn't work. You have to create an instance:
var main = new Main();
main.Sub; //<-- now you can access it
2) You try to access the property my_object with this, but outside of any function. That doesn't work either. this will probably point to the window object, which doesn't have any property called my_object. The solution could be to write main.my_object but that would kind of defeat the purpose of the prototype. Usally you would put there function or properties that are the same for every instance. But you are trying to put a property in there that should be different for every instance. So it looks like you don't need to access the prototype at all but can just define it as a regular property:
function Main()
{
this.my_object = {"key":123};
this.Sub = new Sub(this.my_object);
}
3) The line main.Sub doesn't execute anything. You are just requesting the property Sub. Instead the function Sub will be executed when you write new Sub(...). So if you want to alert something by calling a function, you have to define a function. You could for instance define an alert method in Sub or in Sub.prototype and then call this method:
function Sub(obj)
{
this.alert() {
alert(obj);
}
}
main.Sub.alert();
updated Fiddle
Mainis a function object. If you want to be able to accessMain.Sub, you have to assign toMain.Subfirst.new Sub(this.my_object);,thisrefers towindowobject here.