I'm calling a stored procedure using seriate to register users and the output JSON like this when the user is created and the first value {"":208} is the generated userId
{"sets":{"sp_CreateNewUser":[[[{"":208}],[{"":1664}],[{"":1665}],[{"":1666}],[{"":1667}],[{"":1668}],[{"":1669}],[{"":1670}],[{"":1671}],[{"":210}],[{"":212}]],0]},"transaction":{}}
and it looks like this when it fails
{"sets":{"sp_CreateNewUser":[[[{"":-1}]],0]},"transaction":{}}
How can I parse this output so to grab the userId and pass it to the next function or if the out put -1 to do another function.
After trying all sort of parsing and looping methods with no luck, not sure if its the best way to do, but I found I can grab it and assign variable this way
var id = user.sets.sp_CreateNewUser['0']['0']['0'][''];
after success i get id = '208'
or id = '-1'
on failure