Ecto Fragment with dynamic JSON fields

I don’t think unsafe_fragment is needed for this use-case. It sounds similar to my Building an Ecto macro to generate a row value question.

The core of creating that macro was:

    quote do
      fragment(unquote(frag_text), unquote_splicing(frag_arguments))
    end

Where frag_text is a binding that contains a variable amount of "?" and frag_arguments is a list with a value for each question mark.

@steffan_levet A few more examples of input and manual query would make it easier to help out.