only json encode once