We are receiving an input parameter value as a pipe-delimited key-value pair, separated with = symbols. For example:
\"|User=0101|Name=ImNewUse
I would just use regular expressions to group (see here) each KEY=VALUE pair and then iterate over them to fill up the JSON object. So you could have something like this:
var re = /(([^=\|]+)=([^=\|]+))/g;
var match;
var myString = "|User=0101|Name=ImNewUser|IsAdmin=0|RefId=23ae2123cd223bf235|";
while (match = re.exec(myString)) {
console.log(match);
// first iteration returns ["User=0101","User=0101","User","0101"] and so on
}