I am faced with a situation where I need to pass variables that are considered Javascript objects
, in a format similar to the following:
var pageVars= [
{ origin:'page', property:'name', value:'whatever' },
{ origin:'session', property:'language', value:'whatever' },
];
The challenge lies in the fact that the value associated with these objects can contain any character, making it tricky to handle. In an attempt to address this issue, I experimented with using
JSON.stringify('whatever')
However, this approach proved ineffective when encountering cases like
JSON.stringify('what'ever');
Given this scenario, what would be the most appropriate course of action?