kandi X-RAY | akka-stream-json Summary
kandi X-RAY | akka-stream-json Summary
akka-stream-json
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of akka-stream-json
akka-stream-json Key Features
akka-stream-json Examples and Code Snippets
Community Discussions
Trending Discussions on akka-stream-json
QUESTION
I have a Source[ByteString, _]
from an input file with 3 rows like this (in reality the input is a TCP socket with a continuos stream):
ANSWER
Answered 2017-May-26 at 21:41Unfortunately, I'm not aware of any Scala libraries which support stream-based parsing of JSON. It seems to me that some support for this is available in Google Gson, but I'm not entirely sure it can properly handle "broken" input.
What you can do, however, is to collect JSON documents in a streaming fashion, similarly to what Framing.delimiter
does. This is very similar to the alternative you have mentioned, but it is not using fold()
; if you do go this way, you would probably need to mimic what Framing.delimiter
does but instead of looking for a single delimiter, you will need to balance curly braces (and optionally brackets, if top-level arrays are possible), buffering the intermediate data, until the entire document comes through, which you would emit as a single chunk suitable for parsing.
Just as a side note, an appropriate interface for a streaming JSON parser suitable to be used in Akka Streams could look like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install akka-stream-json
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page