Remove python unicode "u:" from string in YAQL

Hello. I’m in a stackstorm workflow trying to construct a dict object and pass it as a string to core.http.
Above action runs, but fails as the body has the ‘u’ for unicode embedded in front of all the values ( u\‘reason\’: u\‘reasoncode\’ …).

  action: core.http
    url: "http://url:port/index/_doc/"
    method: POST
    body: '<% str( { "run_id"=> $.run_id, "results"=> $.results }) %>'
      Content-Type: "application/json

How do I produce a string that does NOT have Python unicode encoding for the body?

Try something like the tojson filter

Thanks! That did it!

1 Like

how to use tojson filter? would you please give an example?