1. Ron Calder
  2. PowerBuilder
  3. Monday, 5 February 2018 19:30 PM UTC

The following JSON string is unsupported in PB2017 R2:

{
        "empId":191,
        "fname":"Jeannette",
        "lname":"bertrand",
         "manager":
                  {
                           "managerid":703,
                           "fname":"David",
                           "lname":"Scott"
                   },
         "department":
                   {
                           "deptid":200,
                           "name":"Sales"
                   }
}

Will this change in a future release?

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 5 February 2018 20:53 PM UTC
  2. PowerBuilder
  3. # 1

Hi Ron;

  This is not a problem for the JSON Parser. Remember though that you need to treat the parser and  its embedded data like a TreeView or PBDOM data stream. That is you need to navigate through the Parent/Child structures. You can have a root segment - followed by various embedded child segments within the data stream  Therefore you need to get the Root segment - which in your case would be Employee information and then get the child segments and their data. Which in your case would be "Manager" and "Department.

   In order to process this JSON structure, I would suggest having a look at the GetRootItem (), GetChildItem() and GetChildCount() methods to help you navigate the structure that you portrayed.

HTH

Regards ... Chris

 

Comment
  1. SHIJILESH CHERROT
  2. Wednesday, 7 February 2018 07:46 AM UTC
Hi Chris,



 



In future can we expect a feature like split JSON Parser to json data objects, apply directly to datawindows and after correction combine the json data objects and send back to the api?



 



Thanks



Shijilesh



 

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.