title: How to get rid of quotes in a json string resulting from converting scientific notation to exact value
body: <p>I have a list of dictionary items that I will iterate through to update into a dictionary. That dictionary will be converted to a json string which will get inserted into an SQL database. My problem is that some of those values in the dictionary items can be very small (or large), and thus Python automatically puts it in scientific notation. </p>
  
  <p>For example, I have this dictionary: <code>{"Name": {"Key1": "0.000006", "Key2": "0.0000000001"}}</code>. I've been able to convert scientific notation to an exact value string using the function that I created below. But now I have to keep it as a string because as soon as I cast <code>float()</code> on that string, it goes back to scientific notation. So then when I use <code>json.dumps()</code> to put the dictionary into a json string, it creates unnecessary quotes around those string-casted float values: <code>"{"Name": {"Key1": "0.000006", "Key2": "0.0000000001"}}"</code>. How do I get rid of those quotes? </p>
  
  <pre><code>def format_float(self, value):
      value_string = str(value)
      # Anything smaller than or equal to 1e-5 will get converted to scientific notation
      # If the value is in scientific notation
      if 1e-323 &lt;= abs(value) &lt;= 1e-5:
          # Split the string by the exponent sign
          split_value_string = value_string.split("e-")
          # Get the exponential
          exponential = int(split_value_string[1])
          # If there is a decimal, there could be digits after the decimal
          if "." in split_value_string[0]:
              precision = len(split_value_string[0].split(".")[1])
          else:
              precision = 0
          f = "%.*f" % (exponential + precision, value)
      elif value == float("inf") or value == float("-inf"):
          return value
      # Not in scientific notation
      else:
          if "." in value_string:
              precision = len(value_string.split(".")[1])
          else:
              precision = 0
          f = "%.*f" % (precision, value)
      # No decimal
      if "." not in f:
          f += ".0"
  
      p = f.partition(".")
  
      s = "".join((p[0], p[1], p[2][0], p[2][1:].rstrip("0")))  # Get rid of the excess 0s
  
      return s
  </code></pre>