Bloob.BodyToJsonConverter = function() {};
Bloob.BodyToJsonConverter.bodyToJson = function(body) {
	var resultJson = {
		"class": "Body",
		// TODO: convert shape and point masses
		"shape": undefined,
		"pointMasses": undefined,
		"translate": body.getDerivedPosition().copy(),
		"rotate": body.getDerivedAngle(),
		"scale": body.getScale().copy(),
		"isKinematic": body.getIsKinematic()
	};

	return resultJson;
};

Body.prototype.toJson = function() {
	var resultJson = Bloob.BodyToJsonConverter.bodyToJson(this);

	return resultJson;
};

SpringBody.prototype.toJson = function() {
	var resultJson = Body.prototype.toJson.apply(this, arguments);

	// adjustments for spring bodies
	resultJson.class = "SpringBody";
	resultJson.edgeSpringK = this.mEdgeSpringK;
	resultJson.edgeSpringDamp = this.mEdgeSpringDamp;
	resultJson.shapeSpringK = this.mShapeSpringK;
	resultJson.shapeSpringDamp = this.mShapeSpringDamp;

	resultJson.internalSprings = [];
	for (var i = this.mPointCount; i < this.mSprings.length; i++)
		resultJson.internalSprings.push(this.mSprings[i].toJson());

	return resultJson;
};

PressureBody.prototype.toJson = function() {
	var resultJson = SpringBody.prototype.toJson.apply(this, arguments);
	
	// adjustments for pressure bodies
	resultJson.class = "PressureBody";
	resultJson.gasPressure = this.getGasPressure();

	return resultJson;
};

@@ -189,25 +189,44 @@
 shape%22: 
-undefined
+body.getBaseShape().toJson()
 ,%0D%0A%09%09%22po
@@ -485,32 +485,22 @@
 n() %7B%0D%0A%09
-var resultJson =
+return
  Bloob.B
@@ -536,39 +536,16 @@
 (this);%0D
-%0A%0D%0A%09return resultJson;%0D
 %0A%7D;%0D%0A%0D%0AS

use baseShapeConverter