Extracting common json serialization components