Parsing a JSON string to an object

Stimulsoft Reports.JS discussion
Post Reply
huangguangc
Posts: 5
Joined: Wed Jul 05, 2023 1:22 am

Parsing a JSON string to an object

Post by huangguangc »

Hello,

i have a question about how to parse JSON string. The data I obtained from the api is as follows

Code: Select all

{
  "name": "Andy",
  "occupation": "[{"id": 1, "name": "Teacher"}, {"id": 2, "name": "doorkeeper"}]"
}
I need to get all of his occupations from the string type JSON array field. How can I do that? Thanks.
Lech Kulikowski
Posts: 6344
Joined: Tue Mar 20, 2018 5:34 am

Re: Parsing a JSON string to an object

Post by Lech Kulikowski »

Hello,

In that case, you should use the following data structure:

Code: Select all

{
  "name": "Andy",
  "occupation": [{"id": 1, "name": "Teacher"}, {"id": 2, "name": "doorkeeper"}]
}
there are no ways to parse it as a string in the designer.
Thank you.
Post Reply