title: Convert JSON camel case to snake case (and vice versa) and stringify numeric values
body: <p>I have to send and receive JSON objects to a web REST service. The objects are produced by a DLL that serializes the attribute names in upper camel case ("PropertyName"), and the web service wants snake case ("property_name").
  Plus, the DLL serializes numeric values as floating point numbers, but the REST APIs want all strings.
  After processing the object, the REST service returns snake case JSON.</p>
  
  <p>The JSON is complex and contains nested arrays and objects. While converting back from the REST string, I can skip the de-stringification of the numeric strings, but I still have to reconvert the attribute names to upper camel case.</p>
  
  <p>I was thinking of writing a helper class using the Newtonsoft Json library, but it looks trickier than I expected. The converter should accept JSON and return JSON.</p>
  
  <p>Example:</p>
  
  <pre><code>{
      "FirstObject": {
          "NestedObject": {
              "AttributeString": "ok",
              "AttributeNumeric": 123.45
          },
          "OtherObject": [{
              "ArrayVal": 100
          }, {
              "ArrayVal": 200
          }]
      }
  }
  </code></pre>
  
  <p>should become</p>
  
  <pre><code>{
      "first_object": {
          "nested_object": {
              "attribute_string": "ok",
              "attribute_numeric": "123.45"
          },
          "other_object": [{
              "array_val": "100"
          }, {
              "array_val": "200"
          }]
      }
  }
  </code></pre>
  
  <p>I see that the Json.Net library has <code>SnakeCaseNamingStrategy</code> and <code>CamelCaseNamingStrategy</code> classes, so the idea was using a <code>JsonTextReader</code> to parse the input, change the naming convention of the property names, set numeric values as string, and write the modified tokens using a <code>JsonTextWriter</code>.</p>
  
  <p>I could not find any sample on how to do this.</p>