How to use '[' in Jsonpath transform http binding

I come back to this post

I need the following JSONPATH

Number nuGold     "Gold: [%.2f EUR]"        (gRRD4J) { http="<[$*.[1])]" }

But it looks like the ‘[’ inside the JSONPATH command break it.

If I use this it is working (because no ‘[’) but gives me the wrong variable part.

String nuGold     "Gold: [%.2f EUR]"        (gRRD4J) { http="<[$*.*)]" }


{"dataset":{"id":11304240,"dataset_code":"GOLD","database_code":"LBMA","name":"Gold Price: London Fixing","description":"Gold Price: London Fixings, London Bullion Market Association (LBMA). Fixing levels are set per troy ounce.\nThe London Gold Fixing Companies set the prices for gold that are globally considered as the international standard for pricing of gold.\nThe Gold price in London is set twice a day by five LBMA Market Makers who comprise the London Gold Market Fixing Limited (LGMFL).\nThe process starts with the announcement from the Chairman of the LGMFL to the other members of the LBMA Market Makers, then relayed to the dealing rooms where customers can express their interest as buyers or sellers and also the quantity they wish to trade. The gold fixing price is then set by collating bids and offers until the supply and demand are matched. At this point the price is announced as the 'Fixed' price for gold and all business is conducted on the basis of that price.","refreshed_at":"2018-01-26T23:55:57.414Z","newest_available_date":"2018-01-26","oldest_available_date":"1968-01-02","column_names":["Date","EURO (PM)"],"frequency":"daily","type":"Time Series","premium":false,"limit":1,"transform":null,"column_index":6,"start_date":"1968-01-02","end_date":"2018-01-26","data":[["2018-01-26",1087.8]],"collapse":null,"order":null,"database_id":139}}

Any idea how to fix it?

Could you maybe try $*.1 ?

I tested that with and it seems to work, alltough i don’t know why exactly. :smile:

I modified the json for testing


and it looks like this now:


I’ve changes my JSONPATH and will see if it is working. I have to wait until monday for the value to change.

I’ve tested it now, it is not working:

On it looks good but not in OH:

String nuGoldtest     "Goldtest: [%.s]"        (gRRD4J) { http="<[$*.1)]" }


2018-01-28 10:55:54.718 [vent.ItemStateChangedEvent] - nuGoldtest changed from ["2018-01-26",1087.8] to []

Any other idea how to escape ‘[’ in JSONPATH?

NOt tested but \[and \] could work.

I tried this before, throws an error.

I played around a little bit more:

http-result which is working

    "ETHEUR": {
        "last": 973.0556089080833,
        "averages": {
            "day": 776.3788039718572
        "timestamp": 1517138754



gives me in online evaluator:


And I can use this as Number item and String item, both hold only the value.

2018-01-28 12:25:22.832 [vent.ItemStateChangedEvent] - stEthereum changed from NULL to 966.7701286063514

If I use the same with my other http-string, it is not working


result in online evaluator:


But item is wrong:

2018-01-28 12:25:22.255 [vent.ItemStateChangedEvent] - stGold changed from NULL to [1087.8]

The brackets are included. And this is why the number item does not get the value.

Maybe the wildcard * causes it to prepare an array.

Are you expecting several values there?
If not you could try $[0].[1]
This will give you the first data element and then the value afterwards.

That is it, thanks a lot.

Does anyone knows how to set this post to solved?


Maybe this is not activated in this category.
If you can’t see it directly you could look in the menu.


That’s it. thanks.

You’re welcome. :slight_smile:

But it would be better to mark this post as solution:

And not the one explaining how to mark a post as solved.
Other users may be confused when they are looking for a jsonpath solution and find a tutorial on how to solve a topic. :smiley: