Plain text can be put into a JSON string just fine. Use a JSON library (like Python's ]json
module](https://docs.python.org/2/library/json.html)) to ensure the data is escaped correctly:
import json
with open('some_text_file.txt') as txtfile:
data = {'filedata': txtfile.read()}
json_data = json.dumps(data)
In Python 2, if you have non-ASCII text you may need to decode the text to Unicode explicitly to ensure it is encoded with the right codec when encoding to JSON again.