1. Yossi Dallal
  2. PowerBuilder
  3. Wednesday, 26 June 2024 14:44 PM UTC

I try to achieve multi level JSON script from datawindow. It suppose to looks like a family tree:

[
  {
     name: "Canada",
     people: [
       {
          name: "Steve",
          children: [
            {
               name: "Linda",
               children: [
                 {
                    name: "Steve, Jr.",
                    friends: [
                      {
                         name: "Kriss"
                      }
                      //, more friends
                    ]
                 }
                 //, more grandchildren
               ]
            }
            //, more parents
          ]
       }
       //, more grandparents
     ]
   }
   //, more countries
 ]


I created a group for each level in the datawindow.

Group 1 = Countries,

Group 2  = People,

Group 3 = Children ...

When I perform  dw_1.ExportJson()  It doesn't creates array inside array.

Is there any way to implement it, or Powerbuilder supports only two levels?

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 26 June 2024 15:27 PM UTC
  2. PowerBuilder
  3. # 1

Hi Yossi;

  For that task, you would use the built-in JSONGenerator PB object class.

FYI: https://docs.appeon.com/pb2022/objects_and_controls/JSONGenerator_object.html

Regards ... Chris

Comment
  1. David Peace (Powersoft)
  2. Wednesday, 26 June 2024 15:59 PM UTC
Yes, I would do the same. The DW export is quite basic and ideal for simple cases.
  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.