I save my html code to sql database as json format
const content = this.state.editorState.getCurrentContent();
const raw = JSON.stringify(convertToRaw(content))
raw is
{"entityMap":{},"blocks":[{"key":"4bk88","text":"ridee","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]}
however when I send it with XMLHTTPRequest in the server it changes req.body become to
post.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
This is how it saves
{"{\"entityMap\":{},\"blocks\":[{\"key\":\"Some Text\",\"text\":\"ridee\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":":[""]}
so after I recieve it does not return as the expected object
const raw = JSON.parse(req.response.htmlcode)
const contentState = convertFromRaw(raw);
{"entityMap":{},"blocks":[{"key":"Some Text","text":"ridee","type":"unstyled","depth":0,"inlineStyleRanges": :
I get this as expected however convertFromRaw gives this error
Cannot convert undefined or null to object
Object.keys(entityMap).forEach(function (storageKey)
Thanks in advance!