updated json encode stuff