Parsing http get response where the key value includes a space


1) Give a description of the problem
An HTTP get response includes spaces in the key value field. I am unable to write a ‘set variable’ expression to match the key field to then directly extract the value.

A working example of this approach where the response does not contain a space is:
With an expression of: {($response.obs.air_temperature)}

Here is the problematic response structure:
[Global:[AB CDE:value]]
The key is “AB CDE”, so includes a space between B and C.

I could use indexof and replace to pull the required value, but this would take multiple steps.
I tried placing quotes around the key value but this just errors.

2) What is the expected behaviour?
Is there a way to parse the reponse directly using the key value ?

3) What is happening/not happening?
Because the response includes spaces my expression errors.

4) Post a Green Snapshot of the pistonimage
Can be provided if needed?


I haven’t tried it in a while but I believe we had to use $replace($response," “,”_") or some other character so we’re able to parse data keys with space in it. Set that new value into a variable then parse that.


Note that @eibyer meant the function replace (not $replace). Also, if your values include spaces, this will also change those. I think you will need a regex for your search string if you don’t want to replace spaces in your values. I’m not good at those but might be something like:


For documentation on replace, see

EDIT: One other question. Did you try escaping the space? i.e., “AB\ CDE”. or “AB%20CDE”