What problem does it solve?
Working with JSON in C requires careful handling of parsing, memory management, and serialization. This Skill provides a complete reference for using yyjson, the single-header ANSI C JSON library bundled in LuisaCompute, covering both immutable and mutable document models.
Core Features & Use Cases
- JSON Reading and Access: Parse JSON from strings, files, or streams with configurable read flags, then query values via type checks, getters, and iterators.
- JSON Creation and Modification: Build and edit documents with the mutable API, including array/object manipulation, JSON Pointer operations, and RFC 6902/7386 patching.
- Serialization and Memory Control: Write minified or pretty-printed JSON with custom allocators, including LuisaCompute's allocator integration pattern.
- Use Case: Read a configuration file with yyjson_read_file, convert it to a mutable document, remove null entries with an iterator, and write the result back with pretty formatting.
Quick Start
Show me how to read a JSON file with yyjson, modify a value, and write it back with pretty printing.