This will produce the output you've specified.
function Vehicle(class_t, type_t)
{
this.typeClass = class_t;
this.typeVehicle = type_t;
}
function test1()
{
var tmp=new Array();
tmp[0] = new Vehicle("SUV", "Chevy");
tmp[1] = new Vehicle("SEDAN", "Nissan");
myDataObject = new Object;
myDataObject.Vehicles = tmp;
objectJSON = JSON.stringify(myDataObject);
console.log(objectJSON);
}
If you wished to convert your existing array, you could do so with a small function.
function test2()
{
var Vehicles = new Array();
Vehicles[0] = new Array("SUV", "Chevy");
Vehicles[1] = new Array("SEDAN", "Nissan");
Vehicles[2] = new Array("COUPE", "Mazda");
Vehicles[3] = new Array("ESTATE", "Volvo");
var i, n = Vehicles.length;
var tmp = new Array();
for (i=0; i<n; i++)
{
tmp[i] = new Vehicle( Vehicles[i][0], Vehicles[i][1] );
}
var mObj = new Object;
mObj.Vehicles = tmp;
var objJSON = JSON.stringify(mObj);
console.log(objJSON);
}