如何解析AEM DAM JSON InputStream和创建JSON对象 [英] How to parse AEM DAM JSON InputStream and create JSON Object

查看:195
本文介绍了如何解析AEM DAM JSON InputStream和创建JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我必须在其中读取AEM DAM中存在的JSON文件。因此,我创建了一个查询以读取inputStream中的JSON文件。使用下面的代码行,我可以在Input Stream中获取JSON文件。现在,我需要知道是否有任何标准库可以读取输入流并创建JSON对象?

I have a requirement where-in I have to read the JSON file which exists in AEM DAM. So, I have created a query to read the JSON file in inputStream. With the below line of code, i could get the JSON file in Input Stream. Now, I need to know If there is any standard library to read the input stream and create the JSON Object?

InputStream is = asset.getOriginal().getStream();


推荐答案

在Java中有许多库可以对JSON进行序列化/反序列化,最引人注目的是Google的Gson: https://github.com/google/gson

There are many libraries for serializing/deserializing JSON in java, the most notable is Google’s Gson: https://github.com/google/gson

我在所有需要JSON操作的AEM项目中都使用了gson。这并不意味着您不能使用其他库。

I’ve used gson in all my AEM projects that require JSON manipulation. That does not mean you can’t use another library.

这篇关于如何解析AEM DAM JSON InputStream和创建JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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