https://promptfoo.dev/ logo
Test cases with double quote (" ") result in parsi...
# ❓|questions
l
My JSON payload doesn't get parsed correctly when double quotes are present in the prompts. I can't use single quotes because JSON requires double, and I also can't use escape characters. What to do?
i
are you able to show me how you are constructing the prompt?
and/or your config
l
I'm looking to red team a RAG model with the following request: body: |- { "context": [], "input": { "document": "{{prompt}}", "locale":"en_US", "translated_document": "How is a?", "translated_lang_code":"en" } } transformResponse: json.results.content The problem is, the {{prompt}} can contain "" which breaks the payload.
i
can you try
Copy code
yaml
      body: |-
        {
            "context":
            [],
            "input":
            {
                "document": {{prompt | dump}},
                "locale":"en_US",
                "translated_document": "How is a?",
                "translated_lang_code":"en"
            }
        }
      transformResponse: json.results.content
this will serialize
prompt
and escape the string as necessary
l
That worked, thank you!