Support Questions

Find answers, ask questions, and share your expertise

Convert Attributes to JSON

Explorer

I wish to convert three variables to a specific json. I am unsure of best method.

The Attributes

fromDate, toDate, id

to JSON

{

"start":"fromDate.value",

"end":"endDate.value"

"where":{ "myid": "id.value" }

}

1 REPLY 1

Super Guru

@lee Arnould

As you are having attributes to the flowfile so

Use ReplaceText processor

91654-screen-shot-2018-10-08-at-82552-pm.png

Search Value

(?s)(^.*$)

Replacement Value

{ 
"start":"${fromDate}",
"end":"${endDate}",
"where":{"myid":"${id}"}
}

Character Set

UTF-8

Maximum Buffer Size

1 MB

Replacement Strategy

Always Replace

Evaluation Mode

Entire text

Output flowfile from ReplaceText will be replaced all the attributes and sends the desired format.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.