We are storing a JSON object in a Data Extension field, then using GTL to parse the JSON and retrieve nested values in the object. It's working really well. However, the challenge is to get the JSON into the Data Extension field in the first place.
I'm using the putDataExtensionRowByKeyAsync method to upsert my data. My request payload looks like this:
PUT https://www.exacttargetapis.com/hub/v1/dataeventsasync/key:3FB7705B-D4D7-40AB-8FA4-596E47C8C627/rows/id:a9714aff-7b96-4164-8139-49df92606c67
Content-Type: application/json
Authorization: Bearer insertAccessTokenHere
{
"values":{
"contactKey":"a0d1a000001OclAAAS",
"letterId":1000123,
"statusCode":200,
"response":"{\"responseContext\":{\"operationStatus\":\"OK\",\"schemaType\":\"Contacts\",\"schemaVersionNumber\":82,\"schemaContextId\":\"56fb9e2b-9937-e511-ac41-b4b52f5ca704\",\"populateInternalProperties\":false},\"eventInstanceID\":\"6d1dc66b-e34d-43f4-88b7-dbee93829d49\",\"asyncRequestID\":3408,\"requestServiceMessageID\":\"ad9b3e54-73f8-4141-a329-dca7da110912\",\"resultMessages\":[],\"serviceMessageID\":\"0e3cffb4-c0b8-4d1c-890e-674ff1c203f2\"}"
}
}
I would expect to see the escaped JSON object appearing in the response field in my Data Extension:
{"responseContext":{"operationStatus":"OK","schemaType":"Contacts","schemaVersionNumber":82,"schemaContextId":"56fb9e2b-9937-e511-ac41-b4b52f5ca704","populateInternalProperties":false},"eventInstanceID":"6d1dc66b-e34d-43f4-88b7-dbee93829d49","asyncRequestID":3408,"requestServiceMessageID":"ad9b3e54-73f8-4141-a329-dca7da110912","resultMessages":[],"serviceMessageID":"0e3cffb4-c0b8-4d1c-890e-674ff1c203f2"}
But they are not escaped. Instead the following is stored in the Data Extension:
{\"responseContext\":{\"operationStatus\":\"OK\",\"schemaType\":\"Contacts\",\"schemaVersionNumber\":82,\"schemaContextId\":\"56fb9e2b-9937-e511-ac41-b4b52f5ca704\",\"populateInternalProperties\":false},\"eventInstanceID\":\"6d1dc66b-e34d-43f4-88b7-dbee93829d49\",\"asyncRequestID\":3408,\"requestServiceMessageID\":\"ad9b3e54-73f8-4141-a329-dca7da110912\",\"resultMessages\":[],\"serviceMessageID\":\"0e3cffb4-c0b8-4d1c-890e-674ff1c203f2\"}
Obviously we need to escape the name/value pairs in the payload request otherwise my request won't be valid. Any suggestions?