Making asJsonString a class function.