GET /json
Returns syntactically invalid JSON with a Content-Type of application/json. Default bundles three flaws in one payload (missing closing brace, unquoted key, trailing comma). Use ?mode= to isolate a single failure mode for targeted parser testing.
mode
Which flaw to send. One of: all (default; three flaws bundled), missing-brace, unquoted-key, trailing-comma.
control Compare against the well-formed counterpart: not.catastrophic.io/json side-by-side
build a request:
expect: A JSON-like body that fails to parse, served with Content-Type: application/json. The specific syntax error depends on the chosen mode.
curl -i 'https://chaos.catastrophic.io/json?mode=all'
import json, urllib.request
raw = urllib.request.urlopen("https://chaos.catastrophic.io/json?mode=all").read()
try:
json.loads(raw)
except json.JSONDecodeError as e:
print(f"Parse error: {e.msg} at line {e.lineno} col {e.colno}")
print("Raw:", raw.decode())
const res = await fetch("https://chaos.catastrophic.io/json?mode=all");
const text = await res.text();
try {
JSON.parse(text);
} catch (e) {
console.error("Parse error:", e.message);
}
console.log("Raw:", text);
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
resp, _ := http.Get("https://chaos.catastrophic.io/json?mode=all")
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
var data any
if err := json.Unmarshal(raw, &data); err != nil {
fmt.Println("Parse error:", err)
}
fmt.Println("Raw:", string(raw))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
// serde_json = "1"
fn main() -> Result<(), Box> {
let raw = reqwest::blocking::get("https://chaos.catastrophic.io/json?mode=all")?.text()?;
match serde_json::from_str::(&raw) {
Ok(_) => println!("Parsed OK"),
Err(e) => eprintln!("Parse error: {e}"),
}
println!("Raw: {raw}");
Ok(())
}
// Requires Jackson: com.fasterxml.jackson.core:jackson-databind
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.*;
public class MalformedJson {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://chaos.catastrophic.io/json?mode=all")).build();
var resp = client.send(req, HttpResponse.BodyHandlers.ofString());
try {
new ObjectMapper().readTree(resp.body());
} catch (Exception e) {
System.err.println("Parse error: " + e.getMessage());
}
System.out.println("Raw: " + resp.body());
}
}
using System.Text.Json;
using var client = new HttpClient();
var raw = await client.GetStringAsync("https://chaos.catastrophic.io/json?mode=all");
try {
JsonDocument.Parse(raw);
} catch (JsonException e) {
Console.Error.WriteLine($"Parse error: {e.Message}");
}
Console.WriteLine($"Raw: {raw}");
require "net/http"
require "json"
raw = Net::HTTP.get(URI("https://chaos.catastrophic.io/json?mode=all"))
begin
JSON.parse(raw)
rescue JSON::ParserError => e
puts "Parse error: #{e.message}"
end
puts "Raw: #{raw}"
# Invoke-RestMethod auto-parses JSON and will throw on this endpoint.
try {
Invoke-RestMethod -Uri 'https://chaos.catastrophic.io/json?mode=all'
} catch {
$_.Exception.Message
}
# Use Invoke-WebRequest to inspect the raw bytes without parsing.
(Invoke-WebRequest -Uri 'https://chaos.catastrophic.io/json?mode=all').Content
headers
body