thrifty-runtime/src/main/java/com/microsoft/thrifty/protocol/JsonProtocol.java
private void writeJsonDouble(double num) throws IOException {
        context.write();
        String str = Double.toString(num);
        boolean special = false;
        switch (str.charAt(0)) {
            case 'N': // NaN
            case 'I': // Infinity
                special = true;
                break;
            case '-':
                if (str.charAt(1) == 'I') { // -Infinity
                    special = true;
                }
                break;
            default:
                break;
        }

        boolean escapeNum = special || context.escapeNum();
        if (escapeNum) {
            transport.write(QUOTE);
        }
        try {
            byte[] b = str.getBytes("UTF-8");
            transport.write(b, 0, b.length);
        } catch (UnsupportedEncodingException e) {
            throw new AssertionError(e);
        }
        if (escapeNum) {
            transport.write(QUOTE);
        }
    }
private void writeJsonDouble(double num) throws IOException {
        context.write();
        String str = Double.toString(num);
        boolean special = false;
        switch (str.charAt(0)) {
            case 'N': // NaN
            case 'I': // Infinity
                special = true;
                break;
            case '-':
                if (str.charAt(1) == 'I') { // -Infinity
                    special = true;
                }
                break;
            default:
                break;
        }

        boolean escapeNum = special || context.escapeNum();
        if (escapeNum) {
            transport.write(QUOTE);
        }
        try {
            byte[] b = str.getBytes("UTF-8");
            transport.write(b, 0, b.length);
        } catch (UnsupportedEncodingException e) {
            throw new AssertionError(e);
        }
        if (escapeNum) {
            transport.write(QUOTE);
        }
    }
context dictates escaping, write out as Json string.