Jump to content

JSON formatting help

boBNunny's Photo
Posted Feb 07 2013 03:23 PM
1235 Views

I have a JSON string that I need to be RECEIVED in the following format:
{"strUseExtID":"false","strObject":"Deal_Support_Requests__c","strAction":"Insert","strDSRLIST":"[{\"Account__c\":\"0016000000G0kWfAAJ\",\"Name\":\"DSR-000001X\",\"Id\":\"a4MW000000000GhMAI\"},{\"Account__c\":\"0016000000G0kWfAAJ\",\"Name\":\"DSR-057433\",\"Id\":\"a4MW00000000GDYMA2\"}]"}

In other words, my JSON string should RESULT in the string above being received by the receiving program (a JSON OF a JSON). The quotes and backslashes included.

When I try to escape the quotes with more backslashes, I receive errors. I am trying to validate this through cURL so that I can properly communicate format. This is not done using Javascript, so I don't have access to all of the standard JSON methods available there.

Can anyone help?

Tags:
0 Subscribe


1 Reply

0
  Rick001's Photo
Posted Feb 19 2013 03:50 PM

Almost there - you only need to double quote the object key pairs. it should look like this:

{"strUseExtID":"false","strObject":"Deal_Support_Requests__c","strAction":"Insert","strDSRLIST":[{"Account__c":"0016000000G0kWfAAJ","Name":"DSR-000001X","Id":"a4MW000000000GhMAI"},{"Account__c":"0016000000G0kWfAAJ","Name":"DSR-057433","Id":"a4MW00000000GDYMA2"}]}