Use encode/decode json instead of to/from to fix unicode issues