Serialize objects into JSON when encoding and parse when decoding.