added json encoder