title: From DynamodbStreamRecord map to JSON string
body: <p>Let's say I have this situation in which I got a <code>DynamodbStreamRecord</code> inside an AWS Lambda.
  From this stream record (variable named <code>record</code>), I have a chain of Java methods that extracts a map in this way:</p>
  
  <pre><code>Map&lt;String, AttributeValue&gt; w1Data = record.getDynamodb().
      getNewImage().  // obtain the image
      get("DT").      // get from key "DT"
      getM().         // obtain the related map
      get("w1_data"). // get from key "w1_data"
      getM();         // obtain the related map
  </code></pre>
  
  <p>Now, I need to transform such <code>w1Data</code> map in a JSON string and I tried to use the <code>org.json.JSONObject</code> constructor that takes a map as input parameter, followed by a <code>toString()</code>:</p>
  
  <pre><code>String jsonRepr = new JSONObject(w1Data).toString();
  </code></pre>
  
  <p>But I obtained this strange string:</p>
  
  <pre><code>'{"SessionExtraInfo":"{M: {Info={M: {CampaignID={N: 3,}, OriginID={N: 1,}, EntitySourceClassID={N: 8,}},}},}"}'
  </code></pre>
  
  <p>which instead should be something like this:</p>
  
  <pre><code>'{"SessionExtraInfo": {"Info": {"OriginID": "1", "CampaignID": "3", "EntitySourceClassID": "8"}}}'
  </code></pre>
  
  <p>Do you have any suggestion to create a valid JSON string from this map without showing the data types specified by DynamoDB?</p>
  
  <p>Thank you very much</p>