[#CSM- 67] Refactor GeneratingJson class

https://issues.openmrs.org/browse/CSM-67