title: How can I sort the JSON output using JSON.NET?
body: <p>I have a requirement to generate JSON that is always sorted in the same way.</p>
  
  <p>Using JSON.NET I've implemented this by first serializing the object to a json string then deserealizing into a sorted dictionary, using StringComparer.Ordinal as the sort order (the order I require) and then serializing that to a json string.
  This works well but only for the set of properties that belong to the top level object.</p>
  
  <p>Once there are sub-objects, sub-dictionaries, sub-lists, etc, this won't work.</p>
  
  <p>I've looked in the documentation but I can't find anything to do with sorting, so my question is:</p>
  
  <p>Is there a way to set JSON.NET to use a particular sort order when serializing to a string?</p>