manually encode json