Is JSON

Determines whether output text conforms to valid JSON format, catching structural errors that break downstream parsing.

Is JSON checks whether a piece of text is valid JSON, catching structural errors before they break a downstream parser. Run it wherever a model is expected to return structured JSON output.

What it does

Is JSON is a deterministic, rule-based eval. It parses the provided text and checks whether it’s valid JSON.

Input

Required InputTypeDescription
textstringThe provided content to be evaluated for JSON validity

Output

FieldTypeDescription
ResultPass / FailPass means the provided content is valid JSON; Fail means it’s not
ReasonstringA plain-language explanation of the evaluation

Run it from code

Call evaluate() with the template name and the eval’s required inputs. It returns the score and the reason.

Note

Before running: install the SDK and set FI_API_KEY / FI_SECRET_KEY. The model argument in the snippets is the evaluator model Future AGI uses to run the eval; turing_flash is a fast default.

from fi.evals import evaluate

result = evaluate(
    "is_json",
    text='{"name": "Alice", "age": 30, "is_member": true}',
    model="turing_flash",
)

print(result.score)
print(result.reason)
import { evaluate } from "@future-agi/ai-evaluation";

const result = await evaluate(
  "is_json",
  {
    text: '{"name": "Alice", "age": 30, "is_member": true}'
  },
  { modelName: "turing_flash" }
);

console.log(result);

When to use

Run Is JSON wherever downstream code parses the model’s output as JSON.

  • Text outputs feeding a json.loads or JSON.parse call in your pipeline
  • API responses where the model generates a structured payload
  • Regression checks after a prompt change, to confirm formatting instructions still hold

What to do when Is JSON fails

Identify common structural problems, such as missing commas, misplaced brackets, or incorrect key-value formatting, and correct them. To prevent future errors, implement automated checks within the system to detect and resolve formatting issues before processing.

Was this page helpful?

Questions & Discussion