Escaping string for json
    /Users/dusanklinec/workspace/monero/external/rapidjson/writer.h
    :param st:
    :return:

def escape_string_json(st):
    """
    Escaping string for json
    /Users/dusanklinec/workspace/monero/external/rapidjson/writer.h
    :param st:
    :return:
    """
    ret = []
    c = 0
    ln = len(st)

    escape_chmap = {
        b'\b': b'b',
        b'\f': b'f',
        b'\n': b'n',
        b'\r': b'r',
        b'\t': b't',
        b'\\': b'\\',
        b'\"': b'"',
        b'\/': b'/'
    }

    while c < ln:
        ch = st[c:c+1]
        if ch in escape_chmap:
            ret.append(b'\\' + escape_chmap[ch])
        elif ord(ch) < 0x20:
            ret.append(b'\\u%04X' % ord(ch))
        else:
            ret.append(ch)
        c += 1
    return b''.join(ret)