title: DynamoDB - Object to AttributeValue
body: <p>I'm aware of DynamoDBMapper but in my case I can't use it because I don't know all the attributes beforehand.</p>
  
  <p>I have a JSON and it's parsed to a map of objects by using <code>Jackson</code> parser:</p>
  
  <pre><code>Map&lt;String, Object&gt; userData = mapper.readValue(new File("user.json"), Map.class);
  </code></pre>
  
  <p>Looping through each attribute, how can I convert the value to <code>AttributeValue</code> given that DynamoDB <code>AttributeValue</code> supports Boolean, String, Number, Bytes, List, etc.</p>
  
  <p>Is there an efficient way to do this? Is there a library for this already? My naive approach is to check if each value is of type Boolean/String/Number/etc. and then call the appropriate <code>AttributeValue</code> method, e.g: <code>new AttributeValue().withN(value.toString())</code> - which gives me long lines of <code>if, else if</code></p>