How to wrap json code so i pass in a variable as the body contents to a webservice
I am using SOAPUI and testing webservices.
Media/Type application/json
Having the below as follows works the webservices is called.
Example below - commented out names etc for here
document":{
"id":"WEBSERVICENAME",
"tranType":"INSERT",
"rows":[
{
"row":{
"rsId":"WEBSERVICENAME_MYFIELD",
"data":{
},
"children":[
{
"row":{
"rsId":"WEBSERVICESNAME_ADDTOCUSTOMER",
"tranType":"INSERT",
"data":{
"MYNAME":"Somevalue",
}
}
]
}
}
How do i wrap this in a variable
I tried this
var s = '
document":{
"id":"WEBSERVICENAME",
"tranType":"INSERT",
"rows":[
{
"row":{
"rsId":"WEBSERVICENAME_MYFIELD",
"data":{
},
"children":[
{
"row":{
"rsId":"WEBSERVICESNAME_ADDTOCUSTOMER",
"tranType":"INSERT",
"data":{
"MYNAME":"Somevalue",
}
}
]
}
}
';
var obj = JSON.parse(s);
Just get message invalid structure returned utils.jsutils.json.JSONParserTokenManager.getNextToken(JSONParserTokenManager.java:547