I don't deny the limitations of CF's JSON serialization, but as far as I can tell:
- Numbers are a valid datatype for JSON, and are/can be represented without quotes. See both the Wikipedia page and
json.org.
- The first thing that's genuinely invalid is that the field name (phone) isn't quoted. That's required. OTOH, no version of CF I tried generated that using serializeJSON, field names are always quoted. Not sure where you got your sample.
- The second thing that's genuinely wrong is that 0000000000 isn't valid as a number. OTOH, that's not a likely phone number either. OTOOH, 1234567890, a more reasonable phone number, gets converted to a float, losing precision, in CF8, but not in CF10. Using javaCast("int", "1234567890") prevents that, but having to do that everywhere there might be an int sucks.
So, the upshot of all this is that CF's JSON handling leaves a lot to be desired, but if you can use CF 10 you'll be better off. (It also formats dates "for you", even if you have a standard, valid internal representation you've already applied. I could go on...)
Beyond that, you could look at the Jackson JSON library for Java, but you'll have a fair amount of workto do to get what CF gives for free, albeit "imperfectly".
Dave Merrill