I generate an output with ChatGPT, transform the Markdown to HTML with the Markdown to HTML Module, and then try to Transform it into JSON with Transform to JSON.
Input is this string: <p>Der Name Oliver hat seinen Ursprung im Altfranzösischen und Altnordischen. Er geht vermutlich auf das altnordische Wort <em>Áleifr</em> zurück, das „Erbe der Vorfahren“ bedeutet. Eine weitere mögliche Herkunft ist das lateinische <em>oliva</em>, was „Olivenbaum“ bedeutet und symbolisch für Frieden steht. Durch die mittelalterliche Dichtung, insbesondere das altfranzösische Rolandslied, wurde der Name in Europa weit verbreitet und ist bis heute populär.</p>
Output of Transform to JSON is just this: "<p>Der Name Oliver hat seinen Ursprung im Altfranzösischen und Altnordischen. Er geht vermutlich auf das altnordische Wort <em>Áleifr</em> zurück, das „Erbe der Vorfahren“ bedeutet. Eine weitere mögliche Herkunft ist das lateinische <em>oliva</em>, was „Olivenbaum“ bedeutet und symbolisch für Frieden steht. Durch die mittelalterliche Dichtung, insbesondere das altfranzösische Rolandslied, wurde der Name in Europa weit verbreitet und ist bis heute populär.</p>"
I cannot get this module to properly escape special characters like the German Umlaute ä,ö,ü or the / in html closing tags.
Do you have any screenshots showing that it doesn’t work?
You have not yet provided sufficient information to demonstrate the problem that would allow us to reproduce the scenario and any error(s).
To allow others to assist you with your scenario, please provide the following:
1. Relevant Screenshots
Could you please share screenshots of your full scenario? Also include screenshots of any error messages, module settings (fields), relevant filter settings (conditions), and module output bundles. We need to see what you’re working with to give you the best advice.
You can upload images here using the Upload icon in the text editor:
2. Output Bundles of Modules
Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).
Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.
Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.
You can upload the file here by clicking on this button:
B. Insert as Formatted Code Block
If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:
Method 1: Type code block manually
Add three backticks ``` before and after the content/bundle, like this:
``` content goes here
```
Method 2. Highlight and click the format button in the editor
Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved.
Sharing these details will make it easier for others to assist you.
[
{
"object": "<p>Der Name Oliver hat seinen Ursprung im Altnordischen und Altfranzösischen. Er wird oft mit dem altnordischen Namen <em>Áleifr</em> in Verbindung gebracht, der „Nachkomme des Vorfahren“ bedeutet. Eine weitere mögliche Herkunft ist das lateinische <em>olivarius</em>, was „Olivenbaum“ oder „Olivenbauer“ bedeutet. Im Mittelalter wurde der Name durch das altfranzösische Heldenepos <em>Rolandslied</em> populär, in dem Ritter Olivier ein treuer Gefährte von Roland ist. Seitdem hat sich Oliver in vielen europäischen Ländern als beliebter Vorname etabliert.</p>\n"
}
]
OUTPUT Bundle
[
{
"json": "\"<p>Der Name Oliver hat seinen Ursprung im Altnordischen und Altfranzösischen. Er wird oft mit dem altnordischen Namen <em>Áleifr</em> in Verbindung gebracht, der „Nachkomme des Vorfahren“ bedeutet. Eine weitere mögliche Herkunft ist das lateinische <em>olivarius</em>, was „Olivenbaum“ oder „Olivenbauer“ bedeutet. Im Mittelalter wurde der Name durch das altfranzösische Heldenepos <em>Rolandslied</em> populär, in dem Ritter Olivier ein treuer Gefährte von Roland ist. Seitdem hat sich Oliver in vielen europäischen Ländern als beliebter Vorname etabliert.</p>\\n\""
}
]
Do you have experience with this as it needs to be HTML properly escaped to be used in a JSON object to be inserted as content into a website that requires the input as JSON object.
So ChatGPT would need to generate an HTML output but also as a JSON object. I am not sure if this is safe enough.
I tried to get GPT results as HTML put even then it already adds some weird pre and post characters and does not simply provide nice clean HTML.
If I use this prompt to convert your html, I think you get the output you are requesting:
Convert the following HTML string to JSON. Preserve HTML tags as escaped entities and ensure that all special characters (e.g., ä, ö, ü, ß) are also properly escaped as HTML entities.
Gives:
{
"text": "Der Name Oliver hat seinen Ursprung im Altfranzösischen und Altnordischen. Er geht vermutlich auf das altnordische Wort <em>Áleifr</em> zurück, das „Erbe der Vorfahren“ bedeutet. Eine weitere mögliche Herkunft ist das lateinische <em>oliva</em>, was „Olivenbaum“ bedeutet und symbolisch für Frieden steht. Durch die mittelalterliche Dichtung, insbesondere das altfranzösische Rolandslied, wurde der Name in Europa weit verbreitet und ist bis heute populär."
}
And you can adjust this to fit it in your usecase and have your first prompt outputted this way.
P.S. if it seems hard to get chatGPT to output the correct way without giving it multiple commands, I usually use chat, give multiple commands and if the output is to my liking, I ask ChatGPT to reformulate my prompt to get this output on the first request.
It totally depends on what you are going to use it for. But again, the best way is just to start a conversation with ChatGPT until you have the output you need, then ask ChatGPT to reformulate the first prompt to get to that last answer.
I understand your issue. The community is more focussed on solutions.
For feature request (improvements) it is best to check https://make.canny.io. If you cannot find a feature request you can add to, you can send in a new one.
If you are good with scripting, you could also implement a scripting step that does the conversion for you.
It ain’t a feature request.
The question I have is referencing a Solution provided in this community.
Just the solution provided in this Topic Seeking Automation for Encoding HTML Code in JSON Requests via make.com seems not to work with an existing Feature, the Markdown to HTML Module.
As for the German characters, these normally don’t need escaping unless you are working with old systems that do not work with UTF-8 encoding. The Make modules are based on UTF-8 and UTF-8 supports the full Unicode character set, including German special characters (ä, ö, ü, ß).
In conclusion, if you put HTML inside a JSON string, you only need to escape <, > and & (and JSON related characters).
If you need to escape the german characters for Non-UTF-8 / legacy systems (i.e. ü to ü), that would be a limitation of the basic modules/functions and would require a feature request or workarounds as discussed earlier.