add json encoding to readjson exmaple