有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

在java/安卓 studio中解析应用程序/ld+json

我正试图从here访问“datePublished”。它在源代码中可见,如下所示:

            <script type="application/ld+json">


{
    "@context": "https://schema.org",
    "@type": "NewsArticle",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.minecraft.net/en-us/article/minecraft-java-edition-1-17-1"
    },
    "headline": "Article headline",
    "image": [
        "https://www.minecraft.net/content/dam/games/minecraft/screenshots/1-17-1-release-header.jpg"
    ],
    "datePublished": "2021-07-06T13:42:49.957+0000",
    "author": {
        "@type": "Person",
        "name": "Adrian Östergård"
    },
    "publisher": {
        "@type": "Organization",
        "name": "Minecraft",
        "logo": {
            "@type": "ImageObject",
            "url": "https://www.minecraft.net/etc.clientlibs/minecraft/clientlibs/main/resources/img/header/logo.png"
        }
    }
}</script>

我尝试过使用url字符串解析器,然后提取json,但是这个元素没有出现在日志中。 非常感谢


共 (1) 个答案

  1. # 1 楼答案

    编辑:在控制台日志上启用了正则表达式,所以日期没有出现。。。 猜猜是谁浪费了大约12小时的生命:')