title: Writing a map to an aerospike bin corrupting the aerospike data
body: <p>I want to write a map bin to aerospike using Java client</p>
  
  <p>The bin should finally look like </p>
  
  <pre><code>{2890:0.75}
  </code></pre>
  
  <p>and here is my code</p>
  
  <pre><code>        HashMap&lt;String, String&gt; newMap = new HashMap&lt;String, String&gt;();
          JsonArray infArray = jsonData.get("inferences").getAsJsonArray();
          for (int i = 0; i &lt; infArray.size(); i++) {
              JsonObject currentInference = infArray.get(i).getAsJsonObject();
              String attrId = currentInference.get("attributeId").getAsString();
              String weight = currentInference.get("weight").getAsString();
              newMap.put(attrId, weight);
          }
          Bin infBin = new Bin("inferences", Value.get(newMap));
          client.put(null, key, infBin);
  </code></pre>
  
  <p>The issue is when I am writing the bin to aerospike the data is getting corrupted or may be getting encoded whatsoever.</p>
  
  <p>For example the map</p>
  
  <pre><code>(inferences:{0=0, 2890=0.75})
  </code></pre>
  
  <p>is getting converted to</p>
  
  <pre><code>AC ED 00 05 73 72 00 11 6A 61 76 61 2E 75 74 69 6C 2E 48 61 73 68 4D 61 70 05 07 DA C1 C3 16 60 D1 03 00 02 46 00 0A 6C 6F 61 64 46 61 63 74 6F 72 49 00 09 74 68 72 65 73 68 6F 6C 64 78 70 3F 40 00 00 00 00 00 0C 77 08 00 00 00 10 00 00 00 02 74 00 04 33
  </code></pre>
  
  <p>I am not sure as to why this is happening. Any help would be of great help as I am totally stuck with this issue. Thanks in advance</p>
  
  <p>Edit1:</p>
  
  <p>Now, there is some interesting thing happening.</p>
  
  <p>I modified the above code as</p>
  
  <pre><code>Bin infBin = new Bin("inferences", Value.getAsMap(newMap));
  </code></pre>
  
  <p>Also modified the HashMap to use Integer and Double as below </p>
  
  <pre><code>            HashMap&lt;Integer, Double&gt; newMap = new HashMap&lt;Integer, Double&gt;();
              JsonArray infArray = jsonData.get("inferences").getAsJsonArray();
              for (int i = 0; i &lt; infArray.size(); i++) {
                  JsonObject currentInference = infArray.get(i).getAsJsonObject();
                  Integer attrId = currentInference.get("attributeId").getAsInt();
                  Double weight = currentInference.get("weight").getAsDouble();
                  newMap.put(attrId, weight);
              }
              Bin infBin = new Bin("inferences", Value.get(newMap));
              client.put(null, key, infBin);
  </code></pre>
  
  <p>Now the first key of the map is getting written correctly to aerospike. But the value is still having the issue.</p>
  
  <p>Then I modified the code again to use Float instead of Double. Then both the keys are getting written correctly of the map are getting written correctly without any issue. But the value is still having the issue.</p>
  
  <p>Then as a final try I modified the Float also as Integer and tried then the aerospike is getting updated properly without any issue. Does this mean that Double and Float are not supported by aerospike Java client? </p>