Convert Pandoc JSON to FictionBook (FB2)
Turn Pandoc JSON, pandoc's document AST as JSON, ideal for programmatic processing, into FictionBook (FB2), the XML-based FictionBook format popular for e-book libraries. FileChanger runs the document conversion in one call, no local tooling to install.
In the browser
Upload a file and download the result, no pipeline required. Open the converter.
One API call
POST the file with from=json and to=fb2, get the converted bytes back. Jump to the code.
From an agent
FileChanger ships an MCP server, so agents can run this conversion themselves. See the docs for setup.
Convert Pandoc JSON to FictionBook (FB2) in code
The same call from any language: POST the file to /api/convert, the response body is the converted file.
curl -X POST https://filechanger.io/api/convert \
-H "X-Api-Key: fc_your_api_key_here" \
-F "file=@input.json" \
-F "from=json" \
-F "to=fb2" \
-o output.fb2import requests
with open("input.json", "rb") as f:
response = requests.post(
"https://filechanger.io/api/convert",
headers={"X-Api-Key": "fc_your_api_key_here"},
files={"file": f},
data={"from": "json", "to": "fb2"},
)
response.raise_for_status()
with open("output.fb2", "wb") as out:
out.write(response.content)const formData = new FormData();
formData.append("file", fileInput.files[0]);
formData.append("from", "json");
formData.append("to", "fb2");
const response = await fetch("https://filechanger.io/api/convert", {
method: "POST",
headers: { "X-Api-Key": "fc_your_api_key_here" },
body: formData,
});
const output = await response.blob();import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.file.Path;
String boundary = "----FormBoundary" + System.currentTimeMillis();
byte[] fileBytes = java.nio.file.Files.readAllBytes(Path.of("input.json"));
String body = "--" + boundary + "\r\n"
+ "Content-Disposition: form-data; name=\"file\"; filename=\"input.json\"\r\n"
+ "Content-Type: application/octet-stream\r\n\r\n"
+ new String(fileBytes) + "\r\n"
+ "--" + boundary + "\r\nContent-Disposition: form-data; name=\"from\"\r\n\r\njson\r\n"
+ "--" + boundary + "\r\nContent-Disposition: form-data; name=\"to\"\r\n\r\nfb2\r\n"
+ "--" + boundary + "--";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://filechanger.io/api/convert"))
.header("X-Api-Key", "fc_your_api_key_here")
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
.POST(BodyPublishers.ofString(body))
.build();
HttpResponse<byte[]> response = client.send(
request, BodyHandlers.ofByteArray());
java.nio.file.Files.write(Path.of("output.fb2"), response.body());import Network.HTTP.Client
import Network.HTTP.Client.MultipartFormData
import qualified Data.ByteString.Lazy as BL
main :: IO ()
main = do
manager <- newManager defaultManagerSettings
initialReq <- parseRequest "POST https://filechanger.io/api/convert"
let req = initialReq
{ requestHeaders = [("X-Api-Key", "fc_your_api_key_here")] }
request <- formDataBody
[ partFileSource "file" "input.json"
, partBS "from" "json"
, partBS "to" "fb2"
] req
response <- httpLbs request manager
BL.writeFile "output.fb2" (responseBody response)About Pandoc JSON
Pandoc JSON is the pandoc document AST serialized as JSON. It is the format of choice for programmatic document processing: filters, linters, and custom tooling read it, transform the tree, and hand it back without ever touching fragile source markup.
Frequently asked questions
How do I convert Pandoc JSON to FictionBook (FB2)?
Upload your file in the browser converter and pick FictionBook (FB2) as the target, or POST it to /api/convert with from=json and to=fb2. The response body is the converted file.
Is converting Pandoc JSON to FictionBook (FB2) free?
Yes. The free tier includes 2 GB of conversions per month, metered on input size. See pricing for the paid tiers.
Is there an API for Pandoc JSON to FictionBook (FB2) conversion?
Yes, this whole conversion is one POST to /api/convert (the code examples above show it in five languages), plus an MCP server so AI agents can run it directly.