解析 JSON 并遍历 Scala 中的对象 [英] Parsing JSON and iterating through the object in Scala

查看:72
本文介绍了解析 JSON 并遍历 Scala 中的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,给定以下 JSON 字符串:

Given, for example, the following JSON string:

[{"id": "user1", "password": "ps1"},{"id": "user2", "password": "ps2"},{"id": "user3", "password": "ps3"}]

在 Scala 中解析它并迭代每个结果并正确分析它的最佳和最优化的方法是什么?

What's the best and most optimized way to parse it in Scala and iterate through every result and analise it properly?

谢谢.

推荐答案

我认为这篇博文对您的问题给出了全面的回答:http://debasishg.blogspot.com/2011/02/applicatives-for-composable-json.html 最后还有一个链接完整的源代码库.

I think this blogpost gives an comprehensive answer to your question: http://debasishg.blogspot.com/2011/02/applicatives-for-composable-json.html at the end there is also a link to a full source repository.

这篇关于解析 JSON 并遍历 Scala 中的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆