How convert Hashmap to JSON string in painless script?


I want to convert a hashmap to a json object or a json string in the painless script.
I know I can use the {{#tojson}} to convert it in the mustache. But I need add slash before each double-quote in the output.
Is there any way can do it?

Thanks a lot.

At this time there is no helper method for this in painless. It will likely come in a future release (hoping for some time in 6.x).

1 Like

Hi, @rjernst

Thank you, I hope too.
I try to concatenate the items' string :cry:

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