title: Dapper result to json (using fastjson)
body: <blockquote>
  <p>===== UPDATED 8/20/2016 =====</p>
  <p>latest version of fastjson can now handle <code>Dictionary&lt;string, ?&gt;</code> type correctly, my problem is solved now.</p>
  <p>=============================</p>
  </blockquote>
  <p>I'm using fastjson to serialize the query result from Dapper, the table in DB has data like this:</p>
  <pre><code>id | name | price
  1  | x    | 100
  2  | y    | 200
  ....
  </code></pre>
  <p>And when I</p>
  <pre><code>using Dapper;
  using fastJSON;
  // ....
  JSON.Parameters.KVStyleStringDictionary = false;
  // ....
  result = JSON.toJSON(conn.Query(&quot;SELECT * FROM tableX&quot;));
  </code></pre>
  <p>I want the result to be:</p>
  <pre><code>[{&quot;id&quot;:1,&quot;name&quot;:&quot;x&quot;,&quot;price&quot;:100},{&quot;id&quot;:2,&quot;name&quot;:&quot;y&quot;,&quot;price&quot;:200},...]
  </code></pre>
  <p>However the actual result outputs:</p>
  <pre><code>[[{&quot;Key&quot;:&quot;id&quot;,&quot;Value&quot;:1},{&quot;Key&quot;:&quot;name&quot;,&quot;Value&quot;:&quot;x&quot;},{&quot;Key&quot;:&quot;price&quot;,&quot;Value&quot;:100}],
  [{&quot;Key&quot;:&quot;id&quot;,&quot;Value&quot;:2},{&quot;Key&quot;:&quot;name&quot;,&quot;Value&quot;:&quot;y&quot;},{&quot;Key&quot;:&quot;price&quot;,&quot;Value&quot;:200}]...]
  </code></pre>
  <p>Lots of key-value pairs are generated which looks redundant.</p>
  <p>Is there a way to get the correct result ?</p>
  <p>Or should I switch to another JSON serializer ?</p>
  <p>========== UPDATED ==========</p>
  <p>makubex88's answer indicates that I can create a customized class mapping the table and use <code>conn.Query&lt;myClass&gt;</code> to get the correct json, though it works for  this scenario, it looks like I have to create hundreds of classes for every table in DB to get ideal json result, which is indeed tiring work for me. (Thanks any way:P)</p>
  <p>Any alternative solutions would be highly appreciated!</p>