I use jsonconvert to convert simple objects to json like
JsonConvert.SerializeObject(new { label = "MyLabel1" });
to
{ "label":"MyLabel1" }
but i want to get the keys without quotation like
{ label: "MyLabel1"}
is there a way to convert objects to json withoud “key”-quotations by using jsonconvert?
Any library that expects JSON or actual JavaScript notation for creating objects (which is a superset of JSON) should work fine with quotes.
But if you really want to remove them, you can set
JsonTextWriter.QuoteNameto false. Doing this requires writing some code thatJsonConvert.SerializeObject()uses by hand: