vscode-restclient icon indicating copy to clipboard operation
vscode-restclient copied to clipboard

Question: Possible to parse response properties further?

Open ChrisRomp opened this issue 2 years ago • 0 comments

Hello - a couple of limitations that I've encountered which require me to copy/paste strings from response values in a chaining fashion.

First question: Is it possible to parse a value from a JSON string returned in a header? For example, a peek operation Azure Service Bus will return a header called BrokerProperties with a value like:

{"DeliveryCount":1,"EnqueuedSequenceNumber":16,"EnqueuedTimeUtc":"Sat, 30 Jul 2022 00:18:15 GMT","LockToken":"guid","LockedUntilUtc":"Sat, 30 Jul 2022 00:18:48 GMT","MessageId":"aaaaaaaaaaaaaaaaaaaa","SequenceNumber":13,"State":"Active","TimeToLive":43200}

I can read the full string using requestName.response.headers.BrokerProperties, but it would be ideal if I could get property values using a syntax like requestName.response.headers.BrokerProperties.$.MessageId. It doesn't seem that this is supported, unless I'm missing something.

Second question: Is it possible to parse a string value further with a substring-like function? For example, if a service returns a 301 redirect, I may want to grab a querystring parameter out of the Location response header value.

Thanks for all the great work on this extension. It's a game-changer for my day-to-day work.

ChrisRomp avatar Jul 30 '22 00:07 ChrisRomp