All Projects → docteurklein → Json Chunks

docteurklein / Json Chunks

streamable json encoder

Projects that are alternatives of or similar to Json Chunks

Jaxon
Streaming JSON parser for Elixir
Stars: ✭ 145 (+752.94%)
Mutual labels:  stream, json
Zipson
JSON parse and stringify with compression
Stars: ✭ 229 (+1247.06%)
Mutual labels:  stream, json
Rtmp Rtsp Stream Client Java
Library to stream in rtmp and rtsp for Android. All code in Java
Stars: ✭ 1,338 (+7770.59%)
Mutual labels:  stream, encoder
Gojay
fastest JSON encoder/decoder with powerful stream API for Golang
Stars: ✭ 2,009 (+11717.65%)
Mutual labels:  json, encoder
Tbox
🎁 A glib-like multi-platform c library
Stars: ✭ 3,800 (+22252.94%)
Mutual labels:  stream, json
Streaming Json Encoder
PHP library for iteratively encoding large JSON documents piece by piece
Stars: ✭ 260 (+1429.41%)
Mutual labels:  json, encoder
Tlog
Terminal I/O logger
Stars: ✭ 170 (+900%)
Mutual labels:  stream, json
Zerocode
A community-developed, free, open source, microservices API automation and load testing framework built using JUnit core runners for Http REST, SOAP, Security, Database, Kafka and much more. Zerocode Open Source enables you to create, change, orchestrate and maintain your automated test cases declaratively with absolute ease.
Stars: ✭ 482 (+2735.29%)
Mutual labels:  stream, json
Ultrajson
Ultra fast JSON decoder and encoder written in C with Python bindings
Stars: ✭ 3,504 (+20511.76%)
Mutual labels:  json, encoder
Ikigajson
A high performance JSON library in Swift
Stars: ✭ 302 (+1676.47%)
Mutual labels:  json, encoder
Json Rust
JSON implementation in Rust
Stars: ✭ 395 (+2223.53%)
Mutual labels:  json, encoder
Jingo
This package provides the ability to encode golang structs to a buffer as JSON very quickly.
Stars: ✭ 715 (+4105.88%)
Mutual labels:  json, encoder
Himotoki
A type-safe JSON decoding library purely written in Swift
Stars: ✭ 786 (+4523.53%)
Mutual labels:  json
Smux
A Stream Multiplexing Library for golang with least memory usage
Stars: ✭ 818 (+4711.76%)
Mutual labels:  stream
Droidparts
Stars: ✭ 785 (+4517.65%)
Mutual labels:  json
Latke
🌀 一款以 JSON 为主的 Java Web 框架。
Stars: ✭ 781 (+4494.12%)
Mutual labels:  json
Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (+4782.35%)
Mutual labels:  json
Dyson
Node server for dynamic, fake JSON.
Stars: ✭ 814 (+4688.24%)
Mutual labels:  json
Amis
前端低代码框架,通过 JSON 配置就能生成各种页面。
Stars: ✭ 8,930 (+52429.41%)
Mutual labels:  json
Ky
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Stars: ✭ 7,047 (+41352.94%)
Mutual labels:  json

json-chunks

What ?

A php library that allows to stream chunks of json documents.

How ?

It takes advantage of php generators and the native json_encode function.
To start streaming parts of a document, pass a function that yield serializable values.

Note: You can nest multiple generators together.

Example

$chunks = DocteurKlein\JsonChunks\Encode::from([
    '_links' => [
        'product' => function() {
            yield from [1, 2, 3];
        },
    ],
    '_embedded' => [
        'product' => function() {
            yield from [
                1,
                2,
                function() {
                    yield from [3];
                }
            ];
        },
    ],
]);

foreach ($chunks as $chunk) {
    echo $chunk;
}

Note: more examples are available in the specs.

Tradeoffs

  • This library won't try to pretty print the streamed content. It provides a pretty option for debug purposes, but that will buffer the whole output and thus won't stream anymore.
  • Arrays containing both numeric and string indexes will be encoded to a json object or array depending on the type of the first key.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].