JSON Utilities

Get Json Type

Determines the JSON type of any value — string, number, boolean, array, object, or null. Use via MCP in Claude Code or Cursor for type validation, or call GET /v1/json/type with your JSON value. Returns the exact RFC 7159 type, essential for schema validation and data processing pipelines.

API Endpoint

GET /v1/json/type

Code Examples

curl "https://tinyfn.io/v1/json/type" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/json/type', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/json/type',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's json tools:

{
  "mcpServers": {
    "tinyfn-json": {
      "url": "https://tinyfn.io/mcp/json",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What JSON types does this tool recognize?

Returns the six standard JSON types: string, number, boolean, array, object, and null. Follows RFC 7159 specification exactly.

How do I check JSON types in my MCP-enabled editor?

Call the get_json_type tool from Cursor, Windsurf, or other MCP clients. Pass any JSON value and get back its type for validation or conditional logic.

Does this handle edge cases like empty arrays or nested objects?

Yes — empty arrays return 'array', empty objects return 'object', and deeply nested structures are typed based on their root level.

What's the difference between this and JavaScript typeof?

This follows JSON specification strictly. JavaScript typeof returns 'object' for arrays and null, while this correctly returns 'array' and 'null'.

Can I use this for schema validation workflows?

Absolutely. Perfect for validating expected types before processing, especially in data transformation pipelines or API request validation.

Try Get Json Type Now

Get your free API key and start using Get Json Type in seconds.

Get Free API Key