How to convert the output into json in watcher body

Hi, I want to convert the output into JSON format in the watcher body. I tried {{#toJson}}. But I couldn't get success. Please guide me through how to resolve this issue?

"body": """{{#toJson}}{{#ctx.payload.hits.hits}} Source:5G Enterprise Status: Active Client_name: DOW Chemicals Metric Name: NDAC Radio FM Data KPI last_updated_time : {{_source.fm_data.last_updated_time}} Alarm_description : {{_source.fm_data.alarm_text}} Severity : {{_source.fm_data.severity}} Radio/Cell : {{_source.fm_data_source.dn}} Nhg_alias : {{_source.fm_data_source.nhg_alias}} Specific_problem : {{_source.fm_data.specific_problem}} Alarm_identifier : {{_source.fm_data.alarm_identifier}} Additional_text : {{_source.fm_data.additional_text}} {{/toJson}}{{/ctx.payload.hits.hits}}""" Thanks

1 Like

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