JSON string to be extracted from header

I have this unique requirement wherein I am getting a JSON string in http header. Although the JSON is valid but when I extract the JSON using:

context.getVariable('request.header.json.values')+"");

The string I received is invalid JSON. Can anyone suggest if this is a bug or I missed something. If this is a bug then can you suggest a workaround. @Dino can you please confirm.


0 3 892
3 REPLIES 3

Not applicable

Please try

context.getVariable('request.header.json.values');

Also, keep in mind that you will need to JSON.parse obtained string.

I already tried this and it returned invalid json:


[{ "key1": "val1", key2": "val2, key3": "val3, key4": "val4, key5": "val5, key6": "val6, key7": "val7, "key8": "val8" }].


Can you confirm if the above mentioned solution worked for you?

Please look at this post on similar scenario.