简体   繁体   English

使用 Scala 处理大型 JSON

[英]Handle large JSON with Scala


I have several files with an array inside and I need to concatenate these arrays.我有几个文件,里面有一个数组,我需要连接这些数组。 The problem is those files are a lot and quite big (around 5mb each, in total more than 100mb).问题是这些文件很多而且很大(每个大约 5mb,总共超过 100mb)。
I tried with PlayJson but I got back a StackOverflow error and I think this is caused by the parsing of the String into the Json Object, so I am looking for another Scala library.我尝试使用 PlayJson,但返回 StackOverflow 错误,我认为这是由于将字符串解析为 Json 对象引起的,因此我正在寻找另一个 Scala 库。 Do you have any suggestion?你有什么建议吗?
I don't care too much for this case to marshal the json to an object, I simply need a way to do some simple changes in the JSON structure.我不太关心这种情况来将 json 编组为一个对象,我只需要一种方法来对 JSON 结构进行一些简单的更改。

You can use Circe + Iteratee or any parser that supports streaming, eg.您可以使用 Circe + Iteratee 或任何支持流式传输的解析器,例如。 Jawn.下巴。

Here is a very good tutorial for Circe + Iteratee.这是 Circe + Iteratee 的一个非常好的教程。

https://github.com/circe/circe/tree/main/examples/sf-city-lots https://github.com/circe/circe/tree/main/examples/sf-city-lots

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM