Serialize JSON properly