OH2 - possible to lose the square bracket with JSONPATH?

I’ve just upgraded my second Pi to OH2, and I can no longer get rid of the square bracket with JSONPATH.
I get this from an APi query

[{"acState":{"on":false,"fanLevel":"auto","temperatureUnit":"C","targetTemperature":20,"mode":"cool","swing":"rangeFull"},"measurements":{"batteryVoltage":2989,"temperature":21.6,"humidity":67.7,"time":{"secondsAgo":27,"time":"2017-04-12T03:20:04Z"},"rssi":-75,"piezo":[null,null]},"room":{"name":"Office","icon":"lounge"},"id":"myID"}]

I then add

var String HeatpumpOn = (transform("JSONPATH", "$..on",HPStatus))

which gives me

[false]

when I actually want

false

in OH 1.8 I used

var String HeatpumpOn = (transform("JSONPATH", "$..on[0]", HPStatus))

which worked, however with OH 2.0 I get a blank result. I believe JSONPATH has been updated which explains the change, but a considerable amount of googling hasn’t given me the new way of doing things.
Can anyone give me a clue what the correct syntax should be?
I could use an extra step such as this, but is there a better way?

val String CleanedString = (HeatpumpOn.replace('[', '').replace(']', ''))

Assuming its syntactically correct, that is probably faster and certainly clearer than making a call out to a generic and somewhat opaque transformation service.

The main risk as you’ve written it is that there might be a square bracket embedded in the JSON content. You could use the regex pair ^[ and ]$ to only match the bracket at the beginning and the one at the end.

Another approach would be just to take the substring without the first and last character, if you were sure that it always was in square brackets. Given the rate you’re probably doing this, I prefer the clarity of the “remove a ‘[’ from the front and a ‘]’ from the end” statement, either in two regex replacements, or in a single one with a capture group of the “inner” part of the string.