[JAVA-104] Support for streams in com.mongodb.util.JSON Created: 14/Apr/10 Updated: 21/Sep/16 Resolved: 21/Sep/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | William Shulman | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
It would be nice if the JSON class supported streams in addition to strings as sources and targets for JSON during parsing and serialization. In particular, I am interested in providing JSON forms to the parser via an InputStream for situations where (a) the JSON objects are very large and more importantly (b) for situations where you want to parse JSON forms from a source one after the other (i.e. a file with a series of JSON forms one after the other). It would be nice if I could create a parser object, provide it with an Input Stream, and then call parse() repeatedly, with the parser parsing and consuming from the stream one JSON object per call. Supporting serialization to OutputStreams would be for symmetry, but also useful for similar reasons. |
| Comments |
| Comment by Jeffrey Yemin [ 21/Sep/16 ] |
|
New development for JSON is being done in the JsonReader and JsonWriter classes. We won't be enhancing com.mongodb.util.JSON. |
| Comment by Aleksey Vorona [ 22/Oct/10 ] |
|
Attached is the class I use in my project to parse JSON streams. If this code is useful to MongoDB developers, you are free to use it. This parser is based on MongoDB default JSON parser, but it differs: Feel free to contact me if you want me to improve this code or merge it to MongoDB Java driver source tree. |