How to convert a transaction into hex before using the sendrawtransaction API?
You cannot convert json string to hex representation. Transactions have their own binary format (you can read in wiki: https://en.bitcoin.it/wiki/Transactions). To create transaction in hex format, you can use bitcoin-qt (or bitcoind) function createrawtransaction. Example of using:

createrawtransaction
'[
    { "txid": "10d5b7f61be2fa2e5979043a7071d3dbd371bc72cefea22e43b2dd54a6e27a99", "vout": 1 }
]'
'{
    "14rbFswzZfkPGkbFZ7Ffj2qhQA1omvgiUx": 0.099
}'


This call will return raw transaction in hex:

0100000001997ae2a654ddb2432ea2fece72bc71d3dbd371703a0479592efae21bf6b7d5100100000000ffffffff01e00f9700000000001976a9142a495afa8b8147ec2f01713b18693cb0a85743b288ac00000000


After that, you must call signrawtransaction:

signrawtransaction 0100000001997ae2a654ddb2432ea2fece72bc71d3dbd371703a0479592efae21bf6b7d5100100000000ffffffff01e00f9700000000001976a9142a495afa8b8147ec2f01713b18693cb0a85743b288ac00000000


This call will return raw transaction in hex, which you can send to network using sendrawtransaction.

Note: be very careful, you can make mistake in amount, and lose your bitcoins.