Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Format JSON

code.format_json

ProductionEngine wrapper (Class A)Deterministicstrictfastv1.0.0
File inputNo network

Overview

When you send JSON text or a file reference, we parse and re-serialize it as pretty-printed or minified output with optional key sorting and indentation. Strict mode (default) rejects comments, trailing commas, and non-numeric numbers per RFC 8259. We do not repair malformed JSON or validate against a schema — do not use this when the input must be fixed before formatting. Accepts file input via file_ref — no need to extract file content first.

Hand-formatted JSON drifts and can corrupt values. We serialize the same way every time so your pipelines stay stable.

Reliability

STRICT and deterministic for identical input and options. Parse failures surface as validation errors (PARSE_ERROR) — fix the JSON text before retrying.

Context footprint

Returns formatted JSON plus original and formatted byte counts. A successful call costs 1 execution credit.

When to use it

When input is valid JSON and you need pretty, minified, or canonical output.

When input is malformed and must be repaired first.

Powered by Jackson, the de-facto JSON engine of the Java ecosystem.

Scope

Note
Pretty-prints or minifies JSON you supply, deterministically.

Non-goals

  • Does not repair invalid JSON
  • Does not validate against a schema
  • Does not preserve comments in strict mode

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

formattingparsing

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input2 MBMax file size2 MB

File limits

Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.

LimitValueLimited by
Maximum size per input file2 MiBSkill maximum

How we handle your data

Sensitive output possible
What this means

This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response may contain submitted or transformed content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
jsonstringNoInline JSON document text; omit it when file_ref is the source.
file_refstringNoTenant-scoped managed JSON file reference; omit it when json is the source.
modestringNoFormatting mode; omit it for pretty.
indentintegerNoPretty-print spaces per level; omit it for 2.
sortKeysbooleanNoWhether object keys are sorted; omit it for false.
ensureFinalNewlinebooleanNoWhether final newline is appended; omit it for true.
strictbooleanNoWhether strict RFC 8259 parsing is used; omit it for true.

Output schema

FieldTypeRequiredDescription
okbooleanYesSuccessful formatting marker, always true.
jsonstringYesRe-serialized JSON text.
validbooleanYesSuccessful parse marker, always true.
originalBytesintegerYesOriginal UTF-8 byte count.
formattedBytesintegerYesFormatted UTF-8 byte count.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"code.format_json","input":{"json":"{\"a\":1}"}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("code.format_json", {"sortKeys":true,"json":"{\"b\":2,\"a\":1}"});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not repair invalid JSON
  • Does not validate against a schema
  • Does not preserve comments in strict mode
  • Repairing malformed JSON
  • JSON with comments when strict=true

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "code.format_json",
  "input": {
    "sortKeys": true,
    "json": "{\"b\":2,\"a\":1}"
  }
}

Examples

Pretty-print with sorted keys

Inputjson
{
  "sortKeys": true,
  "json": "{\"b\":2,\"a\":1}"
}
Expected outputjson
{
  "valid": true,
  "ok": true,
  "originalBytes": 13,
  "formattedBytes": 25,
  "json": "{\n  \"a\" : 1,\n  \"b\" : 2\n}\n"
}

Minify without trailing newline

Inputjson
{
  "json": "{\"a\":1}",
  "ensureFinalNewline": false,
  "mode": "minify"
}
Expected outputjson
{
  "valid": true,
  "ok": true,
  "originalBytes": 7,
  "formattedBytes": 7,
  "json": "{\"a\":1}"
}
  • Normalize agent-generated JSON before storage
  • Minify JSON for transport
  • Canonicalize JSON with sorted keys

Avoid for

  • Repairing malformed JSON
  • JSON with comments when strict=true

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

codejsonformatting