===== UPDATED 8/20/2016 =====
The latest version of fastjson can now handle the type correctly Dictionary<string, ?>, my problem is resolved now.
===============================
I use fastjson to serialize the query result from Dapper, the table in DB has this data:
id | name | price
1 | x | 100
2 | y | 200
....
And when I
using Dapper;
using fastJSON;
JSON.Parameters.KVStyleStringDictionary = false;
result = JSON.toJSON(conn.Query("SELECT * FROM tableX"));
I want the result to be:
[{"id":1,"name":"x","price":100},{"id":2,"name":"y","price":200},...]
However, the actual results of the result:
[[{"Key":"id","Value":1},{"Key":"name","Value":"x"},{"Key":"price","Value":100}],
[{"Key":"id","Value":2},{"Key":"name","Value":"y"},{"Key":"price","Value":200}]...]
Many key-value pairs are created that look redundant.
Is there a way to get the right result?
Or do I need to switch to another JSON serializer?
=========== UPDATED ===========
makubex88 , , , conn.Query<myClass>, json, , , json, . ( : P)
!