Looking to parse a dynamic string with varying combinations of Code, Name, and EffectDate. It could be in the format below with all three properties or just pairs like Code-Name, Code-EffectDate, or Name-EffectDate.
{"Code":{"value":"1"},"Name":{"value":"Entity1"},"EffectDate":{"value":"23/11/2016"}}
and convert it to:
...
this.data[0].key ='Code'; \\desired output
this.data[0].value = '1';
this.data[1].key = 'Name';
this.data[1].value = 'Entity1';
this.data[2].key = 'EffectDate';
this.data[2].value = '23/11/2016';
Here's my approach:
...
filters:string;
data:string[];
...
this.data = this.filters.split("\b(?:(?!value)\w)+[a-zA-Z0-9/]\b");
console.log(this.data);
Using pattern \b(?:(?!value)\w)+[a-zA-Z0-9/]\b, but unable to achieve desired results. The filter returns only one array. Any suggestions are welcome. Thank you!
Update #1:
Working with PrimeNg extension for data tables, I receive events as parameters. The event filters provide a list of filter objects, which I need to convert to a specific format for service compatibility.