UNPKG

@loaders.gl/json

Version:

Framework-independent loader for JSON and streaming JSON formats

37 lines 1.22 kB
import { default as JSONParser } from "./json-parser.js"; import JSONPath from "../jsonpath/jsonpath.js"; /** * The `StreamingJSONParser` looks for the first array in the JSON structure. * and emits an array of chunks */ export default class StreamingJSONParser extends JSONParser { private jsonPaths; private streamingJsonPath; private streamingArray; private topLevelObject; constructor(options?: { [key: string]: any; }); /** * write REDEFINITION * - super.write() chunk to parser * - get the contents (so far) of "topmost-level" array as batch of rows * - clear top-level array * - return the batch of rows\ */ write(chunk: any): any[]; /** * Returns a partially formed result object * Useful for returning the "wrapper" object when array is not top level * e.g. GeoJSON */ getPartialResult(): object | null; getStreamingJsonPath(): JSONPath | null; getStreamingJsonPathAsString(): string | null; getJsonPath(): JSONPath; /** * Checks is this.getJsonPath matches the jsonpaths provided in options */ _matchJSONPath(): boolean; } //# sourceMappingURL=streaming-json-parser.d.ts.map