Assigned variable gets different values depending on assignment method


1) Give a description of the problem
I am assigning a string to my JSON_String for a POST call. The JSON_String gets assigned different values based on how I assign it. If I use the “Value” assignment method, the POST works. If I use the “Expression” method, the JSON_string is different and the POST does not work.


Solution: Use “Value”…

All jokes aside…

I am heading out the door right now, or I would take a closer look


The expression always adds an extra set of “{}” around the entire string so it is evaluated when used which I think is why the ‘[’ at the beginning becomes treated as the start of a device name/attribute and WC gets confused. You probably need to put more inside quotes in the expression method. Can you post a picture of the expression in the entry box?



As @WCmore humorously noted, I can just use the “Value” method. But it is somewhat easier to make edit changes using the “Expression” method.


It may give you other error messages but I suggest trying moving the first quote to the first character and the last quote to the last character. You will need to take out the ''s within the quotes.

If you post the string, I could also play with it a little.



[{“jsonrpc”: “2.0”, “id”: 0, “method”: “Playlist.Clear”, “params”: {“playlistid”: 0}}, {“jsonrpc”:“2.0”,“id”:0,“method”:“Playlist.Add”,“params”:{“playlistid”:0,“item”:{“recursive”:true, “directory”:“special://profile/playlists/music/Christian.xsp”}}}, {“jsonrpc”:“2.0”,“id”:0,“method”:“Player.Open”,“params”:{“item”:{“playlistid”:0,“position”:0}}}]


Definitely strange. By just wrapping single quotes (’) around the entire thing it got rid of the error and seemed to create the right string but it won’t log properly:


@Pantheon let me know if you try this and it still doesn’t work. I can’t test the actual use of the string.


I tried that, and got execution errors. So I just went with the “value” option. It’s working well. Thanks for your help!


I admit, I am a huge fan of using Expressions (instead of Value), but as you discovered, the syntax is a bit different. There are a few cases where I stick with Value just to prevent my hair from turning grey, LOL