json serialization of floating-point values
I'm writing a JSON library for C (see https://github.com/DanielWaterworth/Butterfly ). I can serialize every other data type, but floating-points have stumped me. I need to write 2 functions:

 - The first takes as an argument the number (as a double) to be serialized and returns the length that the serialized string would be (minus the null terminator).
 - The second takes as arguments the number (as a double) and a buffer (which is at least as long as the output of the previous function). It then writes to the buffer and returns the length of the serialized string.

All I need is some helpful hints to get me started.
json serialization of floating-point values
===

I'm writing a JSON library for C (see https://github.com/DanielWaterworth/Butterfly ). I can serialize every other data type, but floating-points have stumped me. I need to write 2 functions:

 - The first takes as an argument the number (as a double) to be serialized and returns the length that the serialized string would be (minus the null terminator).
 - The second takes as arguments the number (as a double) and a buffer (which is at least as long as the output of the previous function). It then writes to the buffer and returns the length of the serialized string.

All I need is some helpful hints to get me started.