Flatten/convert Nested Array Object to string


(Hung Minh Nguyen) #1

I am struggling with formatting nested array object fields where I have data structure like below:

"Target": [
  {
    "ID": "Unknown",
    "Type": 0
  },
  {
    "ID": "known",
    "Type": 1
  },
  {
    "ID": "Maybe",
    "Type": 2
  },
]

I hope to be able to get it all in one document like below:
Target.ID0:Unknown
Target.type0: 0
Target.ID1:known
Target.type1: 1
Target.ID2:Maybe
Target.type2: 2

Split is not a desired option since I do not want to increase the number of document. I think ruby code should be able to handle this but I have had no luck with making ruby work. Can someone please help?

Or even if I could somehow convert this to string where I can apply mutate plugins to perform some formatting, that would work as well.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.