How do I flatten the multi object data and map to a JSON schema uisng reactJS?

I want to generate a form of json schema and map the value.

'queues.bootStrapServers': {
   title: 'BootStrap Servers',
   type: 'array',
   items: { 
     type : "object", 
     properties :{
       'hostUrl' : {
          type : "string"
       }
     }
   }
},

UI schema

'queues.bootStrapServers': {
   'ui:widget': 'CustomTextWidget',
   classNames: 'customwidth_48',
   'ui:options': { type: 'text', placeholder: 'Enter BootStrap Servers' },
 },

 {
   queues.bootStrapServers[0].hostUrl: "kafka://100.200.300.55:6251"
   queues.bootStrapServers[1].hostUrl: "kafka://100.200.300.56:6251"
   queues.bootStrapServers[2].hostUrl: "kafka://100.200.300.57:6251"
 }

Unable to display the value

1 answer

  • answered 2019-06-25 18:56 Thevs

    Here is a possible structure of your schema:

    'queues.bootStrapServers': {
       title: 'BootStrap Servers',
       type: 'array',
       items: [
         { 
         type : "object", 
         properties :{
           'hostUrl' : {
              type : "string"
           }
         }
       },
       {
         type : "object", 
         properties :{
           'hostUrl' : {
              type : "string"
           }
         }
       }
      ]
    },