Jsson Docs

HTTP Server

Built-in REST API for JSSON transpilation.

Start Server

# Default port 8090
jsson serve

# Custom port
jsson serve -port 3000

Server Flags

FlagDefaultDescription
-port8090Port to listen on
-corstrueEnable CORS

Endpoints

EndpointMethodDescription
/transpilePOSTTranspile JSSON source
/validatePOSTValidate JSSON syntax
/validate-schemaPOSTValidate against schema
/healthGETHealth check
/versionGETVersion info

Transpile

Request:

curl -X POST http://localhost:8090/transpile \
  -H "Content-Type: application/json" \
  -d '{
    "source": "user { name = João, age = 25 }",
    "format": "json"
  }'

Response:

{
  "success": true,
  "output": { "user": { "name": "João", "age": 25 } },
  "format": "json",
  "transpile_time_ms": 0.123
}

Options:

{
  "source": "...",
  "format": "json|yaml|toml|typescript",
  "include_merge": "keep|overwrite|error",
  "streaming": true,
  "stream_threshold": 10000
}

Validate Syntax

Request:

curl -X POST http://localhost:8090/validate \
  -H "Content-Type: application/json" \
  -d '{ "source": "user { name = João }" }'

Response:

{
  "valid": true,
  "errors": []
}

Validate with Schema

Request:

curl -X POST http://localhost:8090/validate-schema \
  -H "Content-Type: application/json" \
  -d '{
    "source": "user { name = João, age = 25 }",
    "schema": "{ \"type\": \"object\" }",
    "output_format": "json"
  }'

Response:

{
  "valid": true,
  "errors": [],
  "format": "json",
  "schema_type": "json-schema",
  "transpile_time_ms": 0.1,
  "validate_time_ms": 0.05,
  "transpiled_data": { "user": { "name": "João", "age": 25 } }
}

Health Check

curl http://localhost:8090/health
{
  "status": "healthy",
  "service": "jsson",
  "version": "0.1.0",
  "jsson_version": "0.0.6",
  "timestamp": "2025-12-24T12:00:00Z"
}

Version

curl http://localhost:8090/version
{
  "server_version": "0.1.0",
  "jsson_version": "0.0.6",
  "go_version": "1.21+"
}

Use Cases

Playground Backend

const response = await fetch('http://localhost:8090/transpile', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ source: code, format: 'json' })
});
const { output, errors } = await response.json();

CI/CD Validation

curl -X POST http://localhost:8090/validate-schema \
  -d '{"source": "...", "schema": "..."}' \
  | jq -e '.valid'

Docker

FROM alpine
COPY jsson /usr/local/bin/
EXPOSE 8090
CMD ["jsson", "serve"]

On this page