0

I am sending the following data using a HTTP request:

{
"id": "a",
"jsonrpc": "2.0",
"method": "addJsonEvent",
"params": {
    "common_fields": {
        "source_hwid": "${HWID}",
        "api_key": "${custid}"
    },
    "data": ["{ \"parent_process_path\": \"C:\\\\disk2\\\\process.exe\", \"command_line\": \"\\\"C:\\\\Windows\\\\Microsoft.NET\\\\Framework\\\\v4.0.30319\\\\ngen.exe\\\" uninstall \\\"C:\\\\Windows\\\\assembly\\\\NativeImages_v4.0.30319_32\\\\Microsoft.W2d29a719#\\\\fdb201638092fc8d1310350e099eba45\\\\Microsoft.Windows.DSC.CoreConfProviders.ni.dll\\\" /noroot /LegacyServiceBehavior\", \"api_key\": \"${custid}\" }"]
}}

Looking at the View Results Tree I see that the data sent is the following:

{
"id": "a",
"jsonrpc": "2.0",
"method": "addJsonEvent",
"params": {
    "common_fields": {
        "source_hwid": "560ade69-808e-18a4-7d2a-123-123456000001",
        "api_key": "5a9fb2311da1972e6c8b4567"
    },
    "data": ["{ \"parent_process_path\": \"C:\\disk2\\process.exe\", \"command_line\": \"\\"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\ngen.exe\\" uninstall \\"C:\\Windows\\assembly\\NativeImages_v4.0.30319_32\\Microsoft.W2d29a719#\\fdb201638092fc8d1310350e099eba45\\Microsoft.Windows.DSC.CoreConfProviders.ni.dll\\" /noroot /LegacyServiceBehavior\", \"api_key\": \"5a9fb2311da1972e6c8b4567\" }"]
}}

The actual data sent is no longer a valid JSON.

Is there any way to sent the data as is, without escaping those characters ?

Catalin B
  • 59
  • 7
  • You added the escaping,can't you remove your escaping? – Ori Marko Apr 03 '18 at 15:05
  • No, I can't remove escaping because the processing on the server side will not work. The only thing I found that works, is double escape (escape the escape is that makes sense), but it's a bit odd to do that. – Catalin B Apr 04 '18 at 07:57
  • Did you figure out how to resolve this? – Abhishek Asthana Mar 22 '19 at 13:39
  • 1
    @AbhishekAsthana I managed to make it work by double escaping where needed. As an observation, if request data doest not contain variables ("${HWID}"), the request body is no longer escaped. – Catalin B Mar 26 '19 at 09:01
  • 1
    I overcame this problem by reading from a file, massaging it and uploading in a variable to send using HTTP request sampler. We should post our solutions so that next person isn't scratching their heads :) – Abhishek Asthana Mar 26 '19 at 16:49

0 Answers0