Hi,
I have plain text as data, the data involves questions and answers. This can be think as key/value. and I want to parse this plain text into JSON. Do you know how I can do this in make? I can do it in javascript.
My plain text data is only a question and answer flow like this;
Question: Answer
Question: Answer
Hi @onurbolaca,
Not sure about how your desired output JSON looks like, but the simplest way you can do is using iterator and text aggregator.
- Setup Iterator that will split the plain text you are getting using newline
- Setup the Text Aggregrator, that will split the result using colon as the seperator.
“{{trim(first(split(2.value; “:”)))}}” : “{{trim(last(split(2.value; “:”)))}}”
This implementation has few issues, also add a filter in between iterator and aggregator to check if the text is empty.
2 Likes