private void WriteObject(Expression Expression) { ObjectExpression obj = (ObjectExpression)Expression; bool hasConstructor = false; if (obj.ConstructorArguments.Count > 0) { hasConstructor = true; _jsonWriter.WriteConstructorStart(obj.ResultType); _jsonWriter.WriteConstructorArgsStart(); foreach (Expression ctorArg in obj.ConstructorArguments) { Write(ctorArg); } _jsonWriter.WriteConstructorArgsEnd(); } if (!hasConstructor || obj.Properties.Count > 0) { _jsonWriter.WriteObjectStart(); foreach (KeyValueExpression keyValue in obj.Properties) { _jsonWriter.WriteKey(keyValue.Key); Write(keyValue.ValueExpression); } _jsonWriter.WriteObjectEnd(); } if (hasConstructor) { _jsonWriter.WriteConstructorEnd(); } }