Hi,
I know how to read/interpret JSON data from an item. I was now trying the opposite, saving JSON data in an item (so I could interface it to another system).
I would like to store this information in an item:
{
"Status": "Armed",
"User": "John"
}
I tried using a rule. I figured escape symbols were needed for the quotes. So I did this:
postUpdate(Tex_Log_Alarm_Status_V3, "{ \"status\":\"Armed\", \"User\":\"John\" }
But I got:
Configuration model 'test.rules' has errors, therefore ignoring it: [30,39]: missing ')' at '{'
[30,41]: mismatched input '\' expecting '}'
The cause is that I didn’t escape the {} symbols. But when I try this:
postUpdate(Tex_Log_Alarm_Status_V3, "\{ \"status\":\"Armed\", \"User\":\"John\" \}
I get:
Configuration model 'test.rules' has errors, therefore ignoring it: [28,39]: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
[30,39]: no viable alternative at input '\'
So I’m kinda stuck here. Does anyone know how to get JSON data in a string item?