added json stream encoding