Rapid account: Saddem-Khadra

Saddem-Khadra / Saddem-Khadra

Discussions

3
Title
Created at (Click to sort ascending)
A
5
The issue with the JSON was that the payload object was not being properly converted to a JSON string before sending it in the request body. In the original code, the `body` field of the `options` object was directly assigned the payload object: ```javascript body: { number, language: "en" } ``` However, when sending data in a fetch request, the body needs to be a JSON string. So, the payload object needed to be converted into a JSON string using `JSON.stringify()`: ```javascript body: JSON.stringify({ number: number, delete_from_sentence: null, currency: "دينار", decimal_currency: "مليم", separator: "و", decimal: 3, language: "ar" }) ``` By making this change, the payload was correctly formatted as a JSON string before being sent in the request body, resolving the issue. mer 2:51 1/5/24
A
5
The issue with the JSON was that the payload object was not being properly converted to a JSON string before sending it in the request body. In the original code, the `body` field of the `options` object was directly assigned the payload object: ```javascript body: { number, language: "en" } ``` However, when sending data in a fetch request, the body needs to be a JSON string. So, the payload object needed to be converted into a JSON string using `JSON.stringify()`: ```javascript body: JSON.stringify({ number: number, delete_from_sentence: null, currency: "دينار", decimal_currency: "مليم", separator: "و", decimal: 3, language: "ar" }) ``` By making this change, the payload was correctly formatted as a JSON string before being sent in the request body, resolving the issue. mer 2:51 1/5/24
A
5
The issue with the JSON was that the payload object was not being properly converted to a JSON string before sending it in the request body. In the original code, the `body` field of the `options` object was directly assigned the payload object: ```javascript body: { number, language: "en" } ``` However, when sending data in a fetch request, the body needs to be a JSON string. So, the payload object needed to be converted into a JSON string using `JSON.stringify()`: ```javascript body: JSON.stringify({ number: number, delete_from_sentence: null, currency: "دينار", decimal_currency: "مليم", separator: "و", decimal: 3, language: "ar" }) ``` By making this change, the payload was correctly formatted as a JSON string before being sent in the request body, resolving the issue. mer 2:51 1/5/24