GET /json
/jsonReturns syntactically valid JSON with a Content-Type of application/json. Counterpart to the chaos /json endpoint, which deliberately ships invalid JSON.
expect: 200 OK with Content-Type: application/json. Body is well-formed JSON that any standard parser accepts.
curl -i 'https://not.catastrophic.io/json'
import json, urllib.request
raw = urllib.request.urlopen("https://not.catastrophic.io/json").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://not.catastrophic.io/json");
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://not.catastrophic.io/json")
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://not.catastrophic.io/json")?.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://not.catastrophic.io/json")).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://not.catastrophic.io/json");
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://not.catastrophic.io/json"))
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://not.catastrophic.io/json'
} catch {
$_.Exception.Message
}
# Use Invoke-WebRequest to inspect the raw bytes without parsing.
(Invoke-WebRequest -Uri 'https://not.catastrophic.io/json').Content
headers
body