All examples use BASE_URL — set it to your deployment URL, e.g. https://winnieapi-v2.yourdomain.com
POST/api/json/format
Beautify JSON with configurable indentation.
const BASE_URL = "http://localhost:3000";
const res = await fetch(`${BASE_URL}/api/json/format`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
json: '{"name":"WinnieAPI-v2","version":1}',
indent: 2 // 2, 4, or "\t"
})
});
const data = await res.json();
// → { success: true, result: "{\n \"name\": \"WinnieAPI-v2\",\n ...}" }
POST/api/json/minify
Minify JSON to a single line.
await fetch(`${BASE_URL}/api/json/minify`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ json: '{ "a" : 1 , "b" : 2 }' })
});
// → { success: true, result: '{"a":1,"b":2}' }
POST/api/json/validate
Check if a string is valid JSON.
await fetch(`${BASE_URL}/api/json/validate`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ json: '{"valid": true}' })
});
// → { success: true, valid: true, message: "Valid JSON ✓" }