Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

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

Avatar

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

90 likes

Total Posts

97 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

90 likes

Total Posts

97 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile
Raj_bounteous
MVP

22-05-2021

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

90 likes

Total Posts

97 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

90 likes

Total Posts

97 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile
Raj_bounteous
MVP

30-05-2021

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

Avatar

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

112 likes

Total Posts

310 posts

Correct Reply

98 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

112 likes

Total Posts

310 posts

Correct Reply

98 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile
_Manoj_Kumar
MVP

27-05-2021

Hello @Raj_bounteous 

 

Can you try using this library?

 

https://github.com/abdolence/x2js

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

Avatar

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

257 likes

Total Posts

372 posts

Correct Reply

151 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

257 likes

Total Posts

372 posts

Correct Reply

151 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile
DavidKangni
MVP

24-05-2021

Hi @Raj_bounteous ,

 

Try this JSON.stringify(result) 

 

Thanks,

David