POST /translator/translate/json

Translate JSON

Translate JSON string values while preserving keys, structure, numbers, and booleans.

Translation API

Translate JSON string values while preserving all keys, nested structure, numbers, booleans, and null values. Only string values are translated, making this ideal for localizing application configuration, API responses, and i18n resource files.

HTTP Request

1
POST /translator/translate/json

Parameters

ParameterTypeRequiredDefaultDescription
sourcestringNo"auto"Source language code. Use auto for automatic detection
targetstringYesTarget language code

Request Body

Send the JSON content as the raw request body with Content-Type: application/json.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "welcome_message": "Welcome to our application",
  "buttons": {
    "submit": "Submit form",
    "cancel": "Cancel",
    "retry": "Try again"
  },
  "errors": {
    "not_found": "The requested resource was not found",
    "unauthorized": "You are not authorized to perform this action"
  },
  "max_retries": 3,
  "enabled": true
}

Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "status": true,
  "data": {
    "translated_json": {
      "welcome_message": "Bienvenue dans notre application",
      "buttons": {
        "submit": "Soumettre le formulaire",
        "cancel": "Annuler",
        "retry": "Reessayer"
      },
      "errors": {
        "not_found": "La ressource demandee n'a pas ete trouvee",
        "unauthorized": "Vous n'etes pas autorise a effectuer cette action"
      },
      "max_retries": 3,
      "enabled": true
    },
    "source_language": "en",
    "source_language_name": "English"
  }
}

Response Fields

FieldTypeDescription
statusbooleanWhether the request was successful
data.translated_jsonobjectThe translated JSON object with structure preserved
data.source_languagestringDetected or specified source language code
data.source_language_namestringHuman-readable name of the source language

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import json

url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/json"

querystring = {
    "source": "auto",
    "target": "fr"
}

payload = json.dumps({
    "welcome_message": "Welcome to our application",
    "buttons": {
        "submit": "Submit form",
        "cancel": "Cancel",
        "retry": "Try again"
    },
    "max_retries": 3
})

headers = {
    "Content-Type": "application/json",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com"
}

response = requests.post(url, headers=headers, params=querystring, data=payload)
data = response.json()

translated = data["data"]["translated_json"]
print(json.dumps(translated, indent=2, ensure_ascii=False))
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/json";

const params = new URLSearchParams({
  source: "auto",
  target: "fr",
});

const payload = {
  welcome_message: "Welcome to our application",
  buttons: {
    submit: "Submit form",
    cancel: "Cancel",
    retry: "Try again",
  },
  max_retries: 3,
};

const response = await fetch(`${url}?${params}`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com",
  },
  body: JSON.stringify(payload),
});

const data = await response.json();
console.log(JSON.stringify(data.data.translated_json, null, 2));
1
2
3
4
5
curl -X POST "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/json?source=auto&target=fr" \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: multi-format-ai-translator-the-most-complete.p.rapidapi.com" \
  -d '{"welcome_message": "Welcome to our application", "buttons": {"submit": "Submit form", "cancel": "Cancel"}}'
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI