fix in toJson: adding support for literals