Fix escaping and quoting rules.

Properly escape binary data using MIME::Base64, all values
need to be quoted as strings even if they are numeric.

Rename type_for_value to type_and_value because the function
now returns the DynamoDB type and the value to be included in JSON.