feat(toJson): cleanup spacing logic