JSON name/value pairs with illegal characters

I have an application where I am sent a JSON with "#"s and "()"s characters. Which is causing an Error_ExpressionEval. Is there a work around?

jsonGet("{‘OP20 Bolt #1 (pre)’:{‘Pass’:true,‘Fail’:false}}",“OP20 Bolt #1 (pre)”)
causes the error

jsonGet("{‘OP20 Bolt 1 pre’:{‘Pass’:true,‘Fail’:false}}",“OP20 Bolt 1 pre”)

Since it contains characters that make it an invalid identifier you have to use this weird escape syntax on your key:

jsonGet("{'OP20 Bolt #1 (pre)':{'Pass':true,'Fail':false}}", "['OP20 Bolt #1 (pre)']")
1 Like