{"uid":"cap_MiBJwjr_9tzvCeG_B9ohF","slug":"pack-openverbs-com-json-encoder-messagepack-cbor-8f067075","name":"pack.openverbs.com JSON Encoder (MessagePack/CBOR)","description":"Serialize a JSON value into a compact MessagePack or CBOR byte stream, returned as a base64 (default), base64url or hex string, along with the byte length.","url":"https://pack.openverbs.com/v1/encode","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["format","data"],"properties":{"data":{"description":"Any JSON value (object, array, string, number, boolean or null)."},"format":{"enum":["msgpack","cbor"],"type":"string","description":"Binary format, one of msgpack, cbor."},"outputEncoding":{"enum":["base64","base64url","hex"],"type":"string","description":"Envelope encoding of the bytes (base64, base64url, hex). Default base64."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_blQcAjJjd-jAn9XoK_tmv","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Serializes any JSON value into a compact MessagePack or CBOR binary byte stream, returned as a base64, base64url, or hex string with byte length.","exampleAgentPrompt":"Serialize this JSON object {\"user\":\"alice\",\"score\":42} into MessagePack format and give me the result as a base64 string.","exampleUseCases":[{"title":"Compact API payload for IoT device","prompt":"Take this sensor reading JSON {\"temp\":23.5,\"humidity\":60,\"ts\":1710000000} and encode it as MessagePack in base64url so I can send a compact binary payload to the device."},{"title":"CBOR encoding for WebAuthn flow","prompt":"Encode this credential JSON {\"id\":\"abc123\",\"type\":\"public-key\"} into CBOR format and return it as a hex string — I need it for a WebAuthn authentication step."},{"title":"Binary cache key for Redis storage","prompt":"Serialize this JSON config object {\"env\":\"prod\",\"version\":3,\"flags\":[\"featureA\"]} into MessagePack as base64 so I can store it as a compact binary blob in Redis."}],"resultDescription":"Returns the binary-encoded byte stream as a base64, base64url, or hex string (default base64), along with the byte length of the encoded output. The format used (msgpack or cbor) is also reflected in the response.","failureModes":["Invalid or missing 'data' field — returns validation error","Unsupported format value (not 'msgpack' or 'cbor') — returns enum validation error","Unsupported outputEncoding value — returns enum validation error","Payment not provided or invalid (x402 protocol error) — returns 402 Payment Required","Malformed JSON body — returns parse error"],"whenToPreferThis":"Choose this endpoint when you need to convert a JSON value into a compact binary wire format (MessagePack or CBOR) with a text-safe envelope (base64/hex), particularly for IoT payloads, WebAuthn, caching, or any protocol that benefits from smaller byte footprint than JSON. Prefer over manual encoding libraries when operating in an agentic context where calling a remote API is simpler than bundling native codec dependencies.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:30:28.054Z","isFirstParty":false}