Solved

Expression-Evaluator

  • 1 September 2022
  • 1 reply
  • 129 views

I need to insert map in empty-list using expression, how to achieve it in streamsets.

 

emptyList(), emptyMap() functions I have tried but no luck.

Can anyone help me please.

 

Ex:-

[

{

“list”: 1

}

]

icon

Best answer by Bikram 1 October 2022, 00:03

View original

1 reply

Userlevel 5
Badge +1

@Priyanka Mynepally 

 

is it fine if we convert map to list using jython evaluator? The below code snippet will convert map to list .

 

Kindly let me know what is your requirement in details , I mean the input and out you are expecting for , so i can give a try and will let you know on the same.

 

import json
for record in sdc.records:
  l=[]
  for (key,val) in record.value.iteritems():
      l += [key, val]
  record.value=l
  output.write(record)

Reply