title: How can I deserialize a comma-separated JSON string as a vector of separate strings?
body: <p>I would like to deserialize my incoming data from Rocket with Serde with my own deserializer for one field. The <code>tags</code> field is originally a string and should be deserialized into a <code>Vec&lt;String&gt;</code>. The format of the string is more-or-less comma-separated values with a special treatment of some characters.</p>
  
  <p>The documentation of Serde is completely unclear for me how to treat that case. The basic structure of <code>tags_deserialize</code> I just copied from the <a href="https://serde.rs/variant-attrs.html#deserialize_with" rel="nofollow noreferrer">documentation</a>.</p>
  
  <p>Currently my code is as follows:</p>
  
  <pre><code>#[derive(Deserialize)]
  #[serde(deny_unknown_fields)]
  pub struct TaskDataJson {
      pub name: String,
      pub description: String,
      #[serde(deserialize_with = "tags_deserialize")]
      pub tags: Vec&lt;String&gt;
  }
  
  fn tags_deserialize&lt;'de, D&gt;(deserializer: D) -&gt; Result&lt;Vec&lt;String&gt;, D::Error&gt;
      where
          D: Deserializer&lt;'de&gt;,
  {
      ??? - How do I access the string coming from the response and how do I set it??
  }
  </code></pre>
  
  <p>A sample of incoming data is:</p>
  
  <pre><code>{
      "name":"name_sample",
      "description":"description_sample",
      "tags":"tag1,tag2,tag5"
  }
  </code></pre>
  
  <p>where this should lead to:</p>
  
  <pre><code>name = "name_sample";
  description = "description_sample"
  tags = ["tag1", "tag2", "tag5"]
  </code></pre>