106-164 byte JSON/TLV field extractor for controlled embedded formats
MIT Licensed | Cross-compiled for ARM Cortex-M4 | Tested on Linux x86-64
Extract JSON/TLV fields on resource-constrained MCUs without malloc or complex parsers.
ARM Cortex-M4 (-Os optimization):
- jet_tiny: 106 bytes - Core field extractor
- jet: 42 bytes - Convenience wrapper (calls jet_tiny)
- tlv: 42 bytes - Binary TLV walker
- Total: 190 bytes for all three functions
x86-64 (-Os optimization):
- jet_tiny: 164 bytes
- jet: 128 bytes
- tlv: 55 bytes
Size comparison:
- cJSON: 3.2 kB + malloc
- JSMN: 800 B + 18 lines token iteration
- Packet Atoms: 106-164 B + 2 lines
Use when: You control message format (sensor ↔ cloud, custom protocols)
Don't use: Parsing third-party APIs with arbitrary structure
450-byte JSON extractor with strings, escapes, top-level arrays, 1-level nesting.
Still 8× smaller than cJSON.
$99 lifetime licence – pre-order:
Extract field value by key name.
Parameters:
- j - JSON string to parse
- k - Key name (without quotes, max 60 characters)
- v - Output buffer for value
- vmax - Size of output buffer
Returns:
- JET_OK - Success
- JET_KEY_MISSING - Field not found
- JET_MALFORMED - Empty/invalid value, or key exceeds 60 characters
- JET_TRUNCATED - Value too large for buffer
Key Length Limit:
- Maximum key name: 60 characters
- Reason: Fixed 64-byte stack buffer avoids malloc overhead
- For longer keys: Use jet_tiny() with custom buffer size
Example:
Low-level extractor using custom search pattern. No key length limit.
Use when:
- Key names exceed 60 characters
- Custom search patterns needed
- Maximum control over buffer allocation
Example:
Long key example:
Walk Type-Length-Value binary data.
Format: [tag:1][len:1][value:len] ...
Example:
Test coverage:
- 20 test vectors
- Edge cases (truncation, malformed, missing keys)
- Known limitations (nested objects, arrays, strings)
- TLV malicious input handling
- Real-world sensor formats
- ✅ ARM Cortex-M4 - Cross-compiled and size-verified
- ✅ Linux x86-64 - Full test suite passing
- ✅ Strict compilation - -Wall -Wextra -Werror -Wpedantic
- 20 torture test vectors - Edge cases, errors, limitations
- 10 real-world protocol tests - AWS IoT, Azure IoT, BME280, GPS, Modbus, weather stations
- Security testing - TLV malicious input protection
- Cross-compilation - ARM Cortex-M verified
- Key length limit (jet only) - 60 character maximum
- Use jet_tiny() for longer keys
- Field order matters - Uses strstr(), finds first match
- Substring collisions - "x" matches in "relax"
- No string support - Extracts with quotes included
- No nested objects/arrays - Extracts garbage
Long keys (>60 chars): Use jet_tiny() directly
Field order: Design protocol with unique prefixes
Strings: Strip quotes manually
- ✅ 106-164 byte JSON / TLV extractor (MIT)
- ✅ 20 torture tests, 10 real-world protocols, ARM-Cortex-M4 verify
- ✅ No malloc, -Werror clean, copy/paste header only
- Full MISRA-C state-machine parser, streaming, fuzz corpus, integration docs
- $1 500, 5-7 biz days after spec approval
- Royalty-free, unlimited product use
| cJSON | 3.2 kB | Easy | Requires malloc |
| JSMN | 800 B | 18 lines per field | Token array iteration |
| Packet Atoms | 106 B | 2 lines | Controlled formats only |
Code comparison:
Size advantage: 8x smaller than JSMN, 30x smaller than cJSON
MIT License - See LICENSE file
No warranty. Test thoroughly before production use.
Issues and PRs welcome for:
- Bug fixes
- Documentation improvements
- Additional test cases
- Platform-specific examples
Not accepting:
- Feature requests for arbitrary JSON (use cJSON/JSMN)
- Breaking API changes
- GitHub Issues: Bug reports and questions
- Email: [email protected]
- Website: http://www.corelathe.com
Built for embedded developers who control their protocols.
.png)
![SpaceX launches 28 Starlink satellites from California's central coast [video]](https://cdn.mos.cms.futurecdn.net/rRpg3oTzu7U7VF2N37c6kZ-1200-80.jpg)
