small cleanup to createJSON(), including check.attributes=FALSE