Changed JSON marshal method to work with map.