streaming_json_parser 0.0.4 streaming_json_parser: ^0.0.4 copied to clipboard
A JSON parser that parses streaming or incomplete JSON
This dart package parses incomplete or "streaming" JSON which is useful for parsing JSON from a stream. For example when you want intermediate parsing results while waiting for the complete JSON to arrive.
It is not suitable for parsing large JSON documents as a stream since the parser starts
from scratch whenever you call the parse
method.
It is based on the code provided by https://github.com/eatonphil/pj and modified slightly to support parsing incomplete JSON.
Features #
- Parses incomplete JSON
Getting started #
In the pubspec.yaml
, add the following dependency:
dependencies:
streaming_json_parser: ^0.0.3
In your library file add the following import:
import 'package:streaming_json_parser/streaming_json_parser.dart';
Usage #
import 'package:streaming_json_parser/streaming_json_parser.dart';
parse('{'); // returns {}
parse('{"key": "value", "someOtherIncomplet'); // returns {"key": "value"}
parse('{"key": ["value", "value2'); // returns {"key": ["value", "value2"]}