Question

I use this example to serialize a dictonary like this

Dictionary<object, object>

What I get is

{ "key": "value" }

what I need is

{ key: "value" }

How do I get this output?

Était-ce utile?

La solution

wrong approach - now I use a simple stringbuilder.

foreach (DictionaryEntry entry in xSet)
{
  result.AppendFormat("{0}: '{1}',", entry.Key, HttpUtility.JavaScriptStringEncode(entry.Value.ToString()));
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top