Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

how to convert query result into JSON to use a body to API call

Avatar

Level 6

Hi,

 

I am trying to make an API call and need query results in the request body. I am finding it difficult to convert the result into a JSON body. Any help is appreciated. Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 6

I tried it in different way and it worked. Created an array with quotes and somehow stringify was throwing error. Didnt use that. 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @Raj_Ganta ,

 

Try this JSON.stringify(result) 

 

Thanks,

David



David Kangni

Avatar

Level 6
I need to remove the root node and as well the the next node after that to make sure body is in proper format. when I try to use removeChild , it is throwing up error.

Avatar

Community Advisor

Hello @Raj_Ganta 

 

Can you try using this library?

 

https://github.com/abdolence/x2js

It has an option to parse with namespaces and root nodes.


     Manoj
     Find me on LinkedIn

Avatar

Correct answer by
Level 6

I tried it in different way and it worked. Created an array with quotes and somehow stringify was throwing error. Didnt use that.