isolating all json specific code