Expand my Community achievements bar.

Don’t miss the Workfront AMA: System Smarts & Strategic Starts! Ask your questions about keeping Workfront running smoothly, planning enhancements, reporting, or adoption, and get practical insights from Adobe experts.

convert string into Object (key value pairs)

Avatar

Employee

I have a string like this "*test1:*value1 *test2:* value2 *test3:**test4:*value4" I need to convert into JSON object(key-value pairs) in the below-shown structure.

output: { "test1":"value1",

              "test2":"value2",

               "test3":"";

              "test4":"value4"}

when there is no value after the key, it must be replaced with the empty string.

Please help me with this.

thanks in advance.. 

 

1 Reply

Avatar

Level 7

Use a Transform to JSON or Create JSON module as your basis, but you'll need to deal with parsing your input stream appropriately.  Things like split or regular expressions will help you with that.  The empty string could be done using ifempty(value; emptystring).