Unexpected character when reading in JSON

There is an API that has been customized for me.
There is a JSON format that I have to pass in a POST request.

I set up a Call API (Data type) and during initialization I insert data, according to a certain structure, the text of my JSON example.
The initialization passes, a picture file is returned back to me.
Everything works.

Next, I make a dynamic parameter in Call API through the value

In Workflow I try to write in the field of type “file” the result of CallAPI work through “Get data from an external API”->saved to S3, passing as a parameter the text in the parameter, which I used during CallAPI initialization.
But in this case I get an error that “Unexpected character when reading in JSON” error was found.

That said, I immediately copy my text sent in , paste it into the call initialization and it works.

I can’t understand what the problem is, what kind of unmoved character is passed to JSON.

Privat" flag is not set

From the logs you should be able to see the api call this tried to make, copy and paste the call here and I will let you know the issue

Here is the request that is sent to JSON. There is an error on it, but I also insert it manually in the Call API, everything works.

{
“ИННОрганизации”: “5029266475”,
“Дата”: “22.02.2024”,
“Номер”: “111”,
“Контрагент”: {
“Наименование”: “OOO "ПРИОРГЛАСС"”,
“НаименованиеПолное”: “ООО "ПРИОРГЛАСС"”,
“НаименованиеДоговора”: “Основной договор”,
“ИНН”: “0”,
“КПП”: “0”,
“ЮридическийАдрес”: "127000, Москва, ул. Волгоградский пр-кт, д. 47, оф.322 ",
“ФактическийАдрес”: "127000, Москва, ул. Волгоградский пр-кт, д. 47, оф.322 "
},
“Услуги”: [
{
“Наименование”: “Пленка Тест 1”,
“Артикул”: “123454878”,
“ЕдиницаИзмеренияКод”: “796”,
“СтавкаНДС”: 20,
“Количество”: 1,
“Цена”: 1000
},
{
“Наименование”: “Пленка Тест 2”,
“Артикул”: “23546577”,
“ЕдиницаИзмеренияКод”: “796”,
“СтавкаНДС”: “Без НДС”,
“Количество”: 1,
“Цена”: 2000
}
]
}

image

If you want to post json here, use ``` around your text. It will give:

Text

For your issue, you will need to use :formatted as json-safe on some of your string because you have characters that will create issue in JSON. when you use :formatted as json-safe, this will also add the double quotes around your string. So you may need to remove it in API Connector

What is there to remove? There is only one parameter.

Not in the body in this case because you didn’t set it there. Go where you set your JSON and use :formatted as json-safe function

New Error
Value is not a value of object type (Property)

I’m trying to write into the field of file type what comes in the response to the API request.
The file of type PDF is returned and I need to replace its name.
However, the name is not replaced

You cannot format all the arbitrary text that contain the whole JSON. You need to format specific part of it
Let’s say:
{"parameter":"text"that"need encoding"}

You will set
{"parameter":inputvalue:format as json safe}

The output will be:
{"parameter":"text\"that\"need encoding"}

In this case, I get an error returned with an unmoved character

It’s hard to know but your json is not correctly encoded for sure. You need to inspect your json and find where is the error. jsonlint can help you inspect the json

Thanks for your input, but as I said, my JSON structure if inserted manually into CallAPI works